From a276bb071ab47e2f4935a9fbe31716266be94009 Mon Sep 17 00:00:00 2001 From: Tiago Rezende Campos Falcao Date: Mon, 27 Sep 2010 21:13:25 +0000 Subject: [PATCH] Refactoring focus_cycle_next_get and copies SVN revision: 52813 --- legacy/elementary/src/lib/elm_panel.c | 13 +++++++++---- legacy/elementary/src/lib/elm_scroller.c | 14 ++++++++++---- legacy/elementary/src/lib/elm_widget.c | 7 +++++-- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/legacy/elementary/src/lib/elm_panel.c b/legacy/elementary/src/lib/elm_panel.c index 7482c400b9..d9f9aecfb3 100644 --- a/legacy/elementary/src/lib/elm_panel.c +++ b/legacy/elementary/src/lib/elm_panel.c @@ -56,6 +56,7 @@ static Eina_Bool _elm_panel_focus_cycle_hook(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool circular) { Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *cur; if ((!wd) || (!wd->content)) return EINA_FALSE; @@ -63,14 +64,18 @@ _elm_panel_focus_cycle_hook(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool if (wd->hidden) return EINA_FALSE; + cur = wd->content; + /* Try Focus cycle in subitem */ - if (elm_widget_focus_cycle(wd->content, dir, circular)) + if (elm_widget_focus_cycle(cur, dir, circular)) return EINA_TRUE; + /* Ignore focused subitem */ + if (elm_widget_focus_get(cur) && (!circular)) + return EINA_FALSE; /* Try give the focus to sub item*/ - else if (elm_widget_can_focus_get(wd->content) && - ((!elm_widget_focus_get(wd->content)) || circular)) + if (elm_widget_can_focus_get(cur)) { - elm_widget_focus_steal(wd->content); + elm_widget_focus_steal(cur); return EINA_TRUE; } diff --git a/legacy/elementary/src/lib/elm_scroller.c b/legacy/elementary/src/lib/elm_scroller.c index 4e45a46f80..67a14e3299 100644 --- a/legacy/elementary/src/lib/elm_scroller.c +++ b/legacy/elementary/src/lib/elm_scroller.c @@ -108,17 +108,23 @@ static Eina_Bool _elm_scroller_focus_cycle_hook(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool circular) { Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *cur; + if ((!wd) || (!wd->content)) return EINA_FALSE; + cur = wd->content; + /* Try Focus cycle in subitem */ - if (elm_widget_focus_cycle(wd->content, dir, circular)) + if (elm_widget_focus_cycle(cur, dir, circular)) return EINA_TRUE; + /* Ignore focused subitem */ + if (elm_widget_focus_get(cur) && (!circular)) + return EINA_FALSE; /* Try give the focus to sub item*/ - else if (elm_widget_can_focus_get(wd->content) && - ((!elm_widget_focus_get(wd->content)) || circular)) + if (elm_widget_can_focus_get(cur)) { - elm_widget_focus_steal(wd->content); + elm_widget_focus_steal(cur); return EINA_TRUE; } diff --git a/legacy/elementary/src/lib/elm_widget.c b/legacy/elementary/src/lib/elm_widget.c index f3fae3ce36..bb3b63df5f 100644 --- a/legacy/elementary/src/lib/elm_widget.c +++ b/legacy/elementary/src/lib/elm_widget.c @@ -757,12 +757,15 @@ elm_widget_focus_cycle_next_get(Evas_Object *obj, Eina_List *items, void *(*list for (;l; l = list_next(l)) { cur = list_data_get(l); + /* Try Focus cycle in subitem */ if (elm_widget_focus_cycle(cur, dir, child_circular)) break; + /* Ignore focused subitem */ + if (elm_widget_focus_get(cur) && (!child_circular)) + continue; /* Try give the focus to sub item*/ - else if (elm_widget_can_focus_get(cur) && - ((!elm_widget_focus_get(cur)) || child_circular)) + if (elm_widget_can_focus_get(cur)) { elm_widget_focus_steal(cur); break;