[*][window] focus will be changed following the focus state of the canvas : 62247
authorWooHyun Jung <wh0705.jung@samsung.com>
Wed, 10 Aug 2011 00:16:43 +0000 (09:16 +0900)
committerWooHyun Jung <wh0705.jung@samsung.com>
Wed, 10 Aug 2011 00:24:09 +0000 (09:24 +0900)
Change-Id: I90d868307b3328ab2d26fc9d30c2a0c0852ff40d

src/lib/elm_widget.c
src/lib/elm_widget.h
src/lib/elm_win.c

index 9c348e8..e73ddbc 100644 (file)
@@ -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;
index 12aa920..0580506 100644 (file)
@@ -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);
index 08ea663..1d42b57 100644 (file)
@@ -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);