From 2fcf5012c9e0f103de9ee3f88a18febe8620b4e8 Mon Sep 17 00:00:00 2001 From: WooHyun Jung Date: Thu, 25 Apr 2013 16:09:54 +0900 Subject: [PATCH] [genlist] If selected item is the first one (or the last one), up (or down) key should do focus movement from genlist to another. --- src/lib/elm_genlist.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c index c404695..afe1337 100644 --- a/src/lib/elm_genlist.c +++ b/src/lib/elm_genlist.c @@ -2606,13 +2606,15 @@ static Elm_Gen_Item *_item_focused_search(Elm_Gen_Item *it, int dir) return tmp; } -static void _item_focused_next(Elm_Genlist_Smart_Data *sd, int dir) +static Eina_Bool _item_focused_next(Elm_Genlist_Smart_Data *sd, int dir) { - Elm_Gen_Item *it; + Elm_Gen_Item *it = NULL, *old_focused = NULL; if (elm_widget_focus_get(ELM_WIDGET_DATA(sd)->obj)) edje_object_signal_emit (ELM_WIDGET_DATA(sd)->resize_obj, "elm,state,unfocused", "elm"); + old_focused = sd->focused; + if (!sd->focused) { if (dir == 1) @@ -2627,6 +2629,11 @@ static void _item_focused_next(Elm_Genlist_Smart_Data *sd, int dir) it = _item_focused_search(it, dir); } _item_focused(it); + + if (old_focused == sd->focused) + return EINA_FALSE; + else + return EINA_TRUE; } static Eina_Bool @@ -2679,9 +2686,13 @@ _elm_genlist_smart_event(Evas_Object *obj, } else { - _item_focused_next(sd, -1); - ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; - return EINA_TRUE; + if (_item_focused_next(sd, -1)) + { + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else + return EINA_FALSE; } } else if ((!strcmp(ev->keyname, "Down")) || @@ -2695,9 +2706,13 @@ _elm_genlist_smart_event(Evas_Object *obj, } else { - _item_focused_next(sd, 1); - ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; - return EINA_TRUE; + if (_item_focused_next(sd, 1)) + { + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; + } + else + return EINA_FALSE; } } else if ((!strcmp(ev->keyname, "Home")) || -- 2.7.4