From 8b9f4c85f141a294ebcb1b04b7171b6095190403 Mon Sep 17 00:00:00 2001 From: WooHyun Jung Date: Wed, 10 Aug 2011 09:16:43 +0900 Subject: [PATCH] [*][window] focus will be changed following the focus state of the canvas : 62247 Change-Id: I90d868307b3328ab2d26fc9d30c2a0c0852ff40d --- src/lib/elm_widget.c | 15 +++++++++++++++ src/lib/elm_widget.h | 16 ++++++++++++++++ src/lib/elm_win.c | 4 +++- 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c index 9c348e8..e73ddbc 100644 --- a/src/lib/elm_widget.c +++ b/src/lib/elm_widget.c @@ -1842,6 +1842,21 @@ elm_widget_focus_steal(Evas_Object *obj) } EAPI void +elm_widget_focus_restore(Evas_Object *obj) +{ + Evas_Object *newest = NULL; + unsigned int newest_focus_order = 0; + API_ENTRY return; + + newest = _newest_focus_order_get(obj, &newest_focus_order, EINA_TRUE); + if (newest) + { + elm_object_unfocus(newest); + elm_object_focus(newest); + } +} + +EAPI void elm_widget_activate(Evas_Object *obj) { API_ENTRY return; diff --git a/src/lib/elm_widget.h b/src/lib/elm_widget.h index 12aa920..0580506 100644 --- a/src/lib/elm_widget.h +++ b/src/lib/elm_widget.h @@ -270,6 +270,22 @@ EAPI void elm_widget_focus_set(Evas_Object *obj, int first); EAPI void elm_widget_focused_object_clear(Evas_Object *obj); EAPI Evas_Object *elm_widget_parent_get(const Evas_Object *obj); EAPI void elm_widget_focus_steal(Evas_Object *obj); + +/** + * @internal + * + * Restore the focus state of the sub-tree. + * + * This API will restore the focus state of the sub-tree to the lastest + * state. If a sub-tree is unfocused and wants to get back to the lastest + * focus state, this API will be helpful. + * + * @param obj The widget root of sub-tree + * + * @ingroup Widget + */ +EAPI void elm_widget_focus_restore(Evas_Object *obj); + EAPI void elm_widget_activate(Evas_Object *obj); EAPI void elm_widget_change(Evas_Object *obj); EAPI void elm_widget_disabled_set(Evas_Object *obj, Eina_Bool disabled); diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c index 08ea663..1d42b57 100644 --- a/src/lib/elm_win.c +++ b/src/lib/elm_win.c @@ -374,7 +374,8 @@ _elm_win_focus_in(Ecore_Evas *ee) if (!obj) return; win = elm_widget_data_get(obj); if (!win) return; - /*NB: Why two different "focus signals" here ??? */ + if (!elm_widget_focus_get(win->win_obj)) + elm_widget_focus_restore(win->win_obj); evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL); win->focus_highlight.cur.visible = EINA_TRUE; _elm_win_focus_highlight_reconfigure_job_start(win); @@ -396,6 +397,7 @@ _elm_win_focus_out(Ecore_Evas *ee) if (!obj) return; win = elm_widget_data_get(obj); if (!win) return; + elm_object_unfocus(win->win_obj); evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL); win->focus_highlight.cur.visible = EINA_FALSE; _elm_win_focus_highlight_reconfigure_job_start(win); -- 2.7.4