From e9afa67f2b030cebf392a043e7e14bc9c6150042 Mon Sep 17 00:00:00 2001 From: Jaehwan Kim Date: Wed, 12 Aug 2015 11:09:14 +0900 Subject: [PATCH] gengird: change focus move mechanism in gengrid. This commit is related to 4d553d2bcf2157053433994ca3facb56bd670da9. It doesn't work if item_select_on_focus_disable is 1. So _item_focus_down is changed like _item_single_select_down. @fix --- legacy/elementary/src/lib/elm_gengrid.c | 38 ++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/legacy/elementary/src/lib/elm_gengrid.c b/legacy/elementary/src/lib/elm_gengrid.c index 5cbda41..ed5599f 100644 --- a/legacy/elementary/src/lib/elm_gengrid.c +++ b/legacy/elementary/src/lib/elm_gengrid.c @@ -2094,32 +2094,40 @@ _item_focus_up(Elm_Gengrid_Data *sd) static Eina_Bool _item_focus_down(Elm_Gengrid_Data *sd) { - unsigned int i; + unsigned int i, idx; Elm_Gen_Item *next = NULL; + Elm_Object_Item *eo_tmp = NULL; if (!sd->focused_item) { next = ELM_GEN_ITEM_FROM_INLIST(sd->items); while ((next) && (next->generation < sd->generation)) next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next); - - elm_object_item_focus_set(EO_OBJ(next), EINA_TRUE); - return EINA_TRUE; } else { - Elm_Object_Item *eo_next = elm_gengrid_item_next_get(sd->focused_item); - if (!eo_next) return EINA_FALSE; - next = eo_data_scope_get(eo_next, ELM_GENGRID_ITEM_CLASS); - if (eo_next == sd->focused_item) return EINA_FALSE; - } - for (i = 1; i < sd->nmax; i++) - { - Elm_Object_Item *eo_tmp = - elm_gengrid_item_next_get(EO_OBJ(next)); - if (!eo_tmp) return EINA_FALSE; - next = eo_data_scope_get(eo_tmp, ELM_GENGRID_ITEM_CLASS); + idx = elm_gengrid_item_index_get(sd->focused_item); + + if (idx > sd->item_count - + ((sd->item_count % sd->nmax) == 0 ? + sd->nmax : (sd->item_count % sd->nmax))) + return EINA_FALSE; + if (idx > sd->item_count - sd->nmax) + { + eo_tmp = elm_gengrid_last_item_get(sd->obj); + next = eo_data_scope_get(eo_tmp, ELM_GENGRID_ITEM_CLASS); + } + else + { + next = eo_data_scope_get(sd->focused_item, ELM_GENGRID_ITEM_CLASS); + for (i = 0; i < sd->nmax; i++) + { + eo_tmp = elm_gengrid_item_next_get(EO_OBJ(next)); + if (!eo_tmp) return EINA_FALSE; + next = eo_data_scope_get(eo_tmp, ELM_GENGRID_ITEM_CLASS); + } + } } elm_object_item_focus_set(EO_OBJ(next), EINA_TRUE); -- 2.7.4