From bdf1f2e510bd7e59d462374b05e5c919088e00f9 Mon Sep 17 00:00:00 2001 From: woohyun Date: Tue, 9 Aug 2011 08:36:02 +0000 Subject: [PATCH] elementary : elm_win didn't be focused/unfocused following the focus state of its ecore_evas. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@62235 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/elm_widget.c | 15 +++++++++++++++ src/lib/elm_widget.h | 16 ++++++++++++++++ src/lib/elm_win.c | 4 ++++ 3 files changed, 35 insertions(+) diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c index 44f50c9..f7793f6 100644 --- a/src/lib/elm_widget.c +++ b/src/lib/elm_widget.c @@ -1945,6 +1945,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_focus_set(newest, EINA_FALSE); + elm_object_focus_set(newest, EINA_TRUE); + } +} + +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 e07515a..bc336c9 100644 --- a/src/lib/elm_widget.h +++ b/src/lib/elm_widget.h @@ -299,6 +299,22 @@ EAPI Evas_Object *elm_widget_parent_get(const Evas_Object *obj); EAPI Evas_Object *elm_widget_parent2_get(const Evas_Object *obj); EAPI void elm_widget_parent2_set(Evas_Object *obj, Evas_Object *parent); 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 860a639..fbd381d 100644 --- a/src/lib/elm_win.c +++ b/src/lib/elm_win.c @@ -306,6 +306,9 @@ _elm_win_focus_in(Ecore_Evas *ee) if (!obj) return; win = elm_widget_data_get(obj); if (!win) return; + elm_widget_focus_restore(win->win_obj); + if (!elm_object_focus_get(win->win_obj)) + elm_object_focus_set(win->win_obj, EINA_TRUE); 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); @@ -327,6 +330,7 @@ _elm_win_focus_out(Ecore_Evas *ee) if (!obj) return; win = elm_widget_data_get(obj); if (!win) return; + elm_object_focus_set(win->win_obj, EINA_FALSE); 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