From 6497ffad3370d462b7793697bb2bdb19fc6dd14d 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 --- src/lib/elm_panel.c | 13 +++++++++---- src/lib/elm_scroller.c | 14 ++++++++++---- src/lib/elm_widget.c | 7 +++++-- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/lib/elm_panel.c b/src/lib/elm_panel.c index 7482c400b..d9f9aecfb 100644 --- a/src/lib/elm_panel.c +++ b/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/src/lib/elm_scroller.c b/src/lib/elm_scroller.c index 4e45a46f8..67a14e329 100644 --- a/src/lib/elm_scroller.c +++ b/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/src/lib/elm_widget.c b/src/lib/elm_widget.c index f3fae3ce3..bb3b63df5 100644 --- a/src/lib/elm_widget.c +++ b/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; -- 2.34.1