From 0141417d5ddd4537aa22a9dc844e14221e52dd8b Mon Sep 17 00:00:00 2001 From: Amitesh Singh Date: Fri, 30 Jun 2017 12:18:33 +0900 Subject: [PATCH] genlist: move to next focusable/selectable item when looping this fixes a bug in genlist when scrolling is enabled and items at top and bottom are disabled. Focus behaviour is not normal in case up arrow is pressed when focus is at the top enabled item or down key is pressed when focus is at bottom enabled item. fixes T5576 --- src/lib/elementary/elm_genlist.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c index 712d6f0e08..762350c3ee 100644 --- a/src/lib/elementary/elm_genlist.c +++ b/src/lib/elementary/elm_genlist.c @@ -2956,7 +2956,7 @@ _key_action_move_dir(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool multi) // handle item loop feature if (sd->item_loop_enable && !sd->item_looping_on) { - if (min > v) + if (min < v) { if (dir == ELM_FOCUS_UP) { @@ -2972,9 +2972,19 @@ _key_action_move_dir(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool multi) else { if (dir == ELM_FOCUS_UP) - it = elm_genlist_last_item_get(obj); + { + it = elm_genlist_last_item_get(obj); + ELM_GENLIST_ITEM_DATA_GET(it, gen_it); + while (_is_no_select(gen_it) || elm_wdg_item_disabled_get(it)) + it = elm_genlist_item_prev_get(it); + } else if (dir == ELM_FOCUS_DOWN) - it = elm_genlist_first_item_get(obj); + { + it = elm_genlist_first_item_get(obj); + ELM_GENLIST_ITEM_DATA_GET(it, gen_it); + while (_is_no_select(gen_it) || elm_wdg_item_disabled_get(it)) + it = elm_genlist_item_next_get(it); + } if (it && focus_only) elm_object_item_focus_set(it, EINA_TRUE);