eext_events: Fix to call elm_win's event callback first. 75/130575/1
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Tue, 20 Dec 2016 07:39:02 +0000 (16:39 +0900)
committerSungtaek Hong <sth253.hong@samsung.com>
Tue, 23 May 2017 04:15:23 +0000 (13:15 +0900)
Until Tizen 2.4, evas_object_top_get() has always returned elm_win.
So elm_win's event callback was always called first.
To support backward compatibility, it is fixed to call elm_win's event
callback first.

Change-Id: I6fee399b4cbcdcfc3340f591af88869916251782

src/efl_extension_events.c

index 9c123b0f6c2dc7f58387ae7e69cf829459c1f1dd..a58827b72611f0ea34e1bb9636e2a7306ba31f45 100644 (file)
@@ -129,21 +129,49 @@ _eext_top_parent_candidates(Eina_List **candidates, Evas *e)
         obj_event->parent = parent;
      }
 
-   //Leave only parent candidates.
-   parent = evas_object_top_get(e);
+   /* The last smart parent of all elementary widgets except elm_win is frame
+    * object (edje) of elm_win.
+    *
+    * Until Tizen 2.4, evas_object_top_get() has always returned elm_win.
+    * As a result, until Tizen 2.4, elm_win was always found as the top parent.
+    *
+    * However, since Tizen 3.0, evas_object_top_get() returns frame object
+    * (edje) of elm_win. (elm_win is below than its frame object.)
+    *
+    * To support backward compatibility, if any obj_event has elm_win as its
+    * parent, elm_win is found as the top parent.
+    */
+   EINA_LIST_FOREACH(_candidates, l, obj_event)
+     {
+        const char *type = evas_object_type_get(obj_event->parent);
+        if (type &&
+            !strncmp(type, "elm_win", strlen(type)))
+          {
+             parent = obj_event->parent;
+             obj_event->parent = NULL;
+             found = EINA_TRUE;
+          }
+     }
 
-   while (parent)
+   //If no obj_event has elm_win as its parent, find top parent from top.
+   if (!found)
      {
-        EINA_LIST_FOREACH(_candidates, l, obj_event)
+        //Leave only parent candidates.
+        parent = evas_object_top_get(e);
+
+        while (parent)
           {
-             if (parent == obj_event->parent)
+             EINA_LIST_FOREACH(_candidates, l, obj_event)
                {
-                  found = EINA_TRUE;
-                  obj_event->parent = NULL;
+                  if (parent == obj_event->parent)
+                    {
+                       found = EINA_TRUE;
+                       obj_event->parent = NULL;
+                    }
                }
+             if (found) break;
+             parent = evas_object_below_get(parent);
           }
-        if (found) break;
-        parent = evas_object_below_get(parent);
      }
 
    //Redundant parents (no candidates)