fix re-focusing of widgets once inlined window is focus. kind of
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 2 Aug 2011 10:34:30 +0000 (10:34 +0000)
committerMike McCormack <mj.mccormack@samsung.com>
Wed, 23 Nov 2011 08:34:56 +0000 (17:34 +0900)
tricky requiring a 2nd shadowed parent.

git-svn-id: https://svn.enlightenment.org/svn/e/trunk/elementary@61989 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

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

index a11644a..b44620c 100644 (file)
@@ -26,6 +26,7 @@ struct _Smart_Data
    Evas_Object *obj;
    const char  *type;
    Evas_Object *parent_obj;
+   Evas_Object *parent2;
    Evas_Coord   x, y, w, h;
    Eina_List   *subobjs;
    Evas_Object *resize_obj;
@@ -1315,6 +1316,24 @@ elm_widget_parent_widget_get(const Evas_Object *obj)
    return parent;
 }
 
+EAPI Evas_Object *
+elm_widget_parent2_get(const Evas_Object *obj)
+{
+   if (_elm_widget_is(obj))
+     {
+        Smart_Data *sd = evas_object_smart_data_get(obj);
+        if (sd) return sd->parent2;
+     }
+   return NULL;
+}
+
+EAPI void
+elm_widget_parent2_set(Evas_Object *obj, Evas_Object *parent)
+{
+   API_ENTRY return;
+   sd->parent2 = parent;
+}
+
 EAPI void
 elm_widget_event_callback_add(Evas_Object *obj,
                               Elm_Event_Cb func,
@@ -1906,7 +1925,7 @@ elm_widget_focused_object_clear(Evas_Object *obj)
 EAPI void
 elm_widget_focus_steal(Evas_Object *obj)
 {
-   Evas_Object *parent, *o;
+   Evas_Object *parent, *parent2, *o;
    API_ENTRY return;
 
    if (sd->focused) return;
@@ -1923,24 +1942,30 @@ elm_widget_focus_steal(Evas_Object *obj)
         if (sd->focused) break;
         parent = o;
      }
-   if (!elm_widget_parent_get(parent))
-     elm_widget_focused_object_clear(parent);
+   if ((!elm_widget_parent_get(parent)) &&
+       (!elm_widget_parent2_get(parent)))
+      elm_widget_focused_object_clear(parent);
    else
      {
-        parent = elm_widget_parent_get(parent);
+        parent2 = elm_widget_parent_get(parent);
+        if (!parent2) parent2 = elm_widget_parent2_get(parent);
+        parent = parent2;
         sd = evas_object_smart_data_get(parent);
-        if ((sd->resize_obj) && (elm_widget_focus_get(sd->resize_obj)))
-          elm_widget_focused_object_clear(sd->resize_obj);
-        else
+        if (sd)
           {
-             const Eina_List *l;
-             Evas_Object *child;
-             EINA_LIST_FOREACH(sd->subobjs, l, child)
+             if ((sd->resize_obj) && (elm_widget_focus_get(sd->resize_obj)))
+                elm_widget_focused_object_clear(sd->resize_obj);
+             else
                {
-                  if (elm_widget_focus_get(child))
+                  const Eina_List *l;
+                  Evas_Object *child;
+                  EINA_LIST_FOREACH(sd->subobjs, l, child)
                     {
-                       elm_widget_focused_object_clear(child);
-                       break;
+                       if (elm_widget_focus_get(child))
+                         {
+                            elm_widget_focused_object_clear(child);
+                            break;
+                         }
                     }
                }
           }
index 6cb400c..8994505 100644 (file)
@@ -352,6 +352,8 @@ EAPI Eina_Bool        elm_widget_focus_list_next_get(const Evas_Object *obj, con
 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 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);
 
 /**
index 4188a66..1a3cd34 100644 (file)
@@ -1554,6 +1554,8 @@ elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
    evas_object_layer_set(win->win_obj, 50);
    evas_object_pass_events_set(win->win_obj, EINA_TRUE);
 
+   if (type == ELM_WIN_INLINED_IMAGE)
+      elm_widget_parent2_set(win->win_obj, parent);
    ecore_evas_object_associate(win->ee, win->win_obj,
                                ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
                                ECORE_EVAS_OBJECT_ASSOCIATE_STACK |