From 7357290056f2f9acb1aedbfddeea7ef3c5d10260 Mon Sep 17 00:00:00 2001 From: Daniel Juyung Seo Date: Mon, 26 May 2014 21:56:10 +0900 Subject: [PATCH] genlist: fixed wrong item focus set on item_focus_set API call. Reset the last_focused_item on _item_focus_set_hook. This fixes the issue which sets the focus to the wrong item when the focus is set by an API. Reproduction step: elementary_test -> genlist focus -> click an item (not the 2nd item) -> click "Focus 2nd Item after 1.5 seconds" button. Focus is not moved to the 2nd item. @fix --- legacy/elementary/src/lib/elm_gengrid.c | 1 + legacy/elementary/src/lib/elm_genlist.c | 1 + legacy/elementary/src/lib/elm_list.c | 1 + legacy/elementary/src/lib/elm_toolbar.c | 1 + 4 files changed, 4 insertions(+) diff --git a/legacy/elementary/src/lib/elm_gengrid.c b/legacy/elementary/src/lib/elm_gengrid.c index 87e5005..11b7254 100644 --- a/legacy/elementary/src/lib/elm_gengrid.c +++ b/legacy/elementary/src/lib/elm_gengrid.c @@ -2930,6 +2930,7 @@ _item_focus_set_hook(Elm_Object_Item *it, Eina_Bool focused) if (focused) { + sd->last_focused_item = it; if (!elm_object_focus_get(obj)) elm_object_focus_set(obj, EINA_TRUE); diff --git a/legacy/elementary/src/lib/elm_genlist.c b/legacy/elementary/src/lib/elm_genlist.c index 880b664..5f73def 100644 --- a/legacy/elementary/src/lib/elm_genlist.c +++ b/legacy/elementary/src/lib/elm_genlist.c @@ -5670,6 +5670,7 @@ _item_focus_set_hook(Elm_Object_Item *it, Eina_Bool focused) if (focused) { + sd->last_focused_item = it; if (!elm_object_focus_get(obj)) elm_object_focus_set(obj, EINA_TRUE); diff --git a/legacy/elementary/src/lib/elm_list.c b/legacy/elementary/src/lib/elm_list.c index e7a8462..4eaa8e1 100644 --- a/legacy/elementary/src/lib/elm_list.c +++ b/legacy/elementary/src/lib/elm_list.c @@ -1946,6 +1946,7 @@ _item_focus_set_hook(Elm_Object_Item *it, Eina_Bool focused) if (focused) { + sd->last_focused_item = it; if (!elm_object_focus_get(obj)) elm_object_focus_set(obj, EINA_TRUE); if (it != sd->focused_item) diff --git a/legacy/elementary/src/lib/elm_toolbar.c b/legacy/elementary/src/lib/elm_toolbar.c index 7607cdd..b9d5a09 100644 --- a/legacy/elementary/src/lib/elm_toolbar.c +++ b/legacy/elementary/src/lib/elm_toolbar.c @@ -806,6 +806,7 @@ _item_focus_set_hook(Elm_Object_Item *it, Eina_Bool focused) if (focused) { + sd->last_focused_item = it; if (!elm_object_focus_get(obj)) elm_object_focus_set(obj, EINA_TRUE); if (it != (Elm_Object_Item *)sd->focused_item) -- 2.7.4