subsurface: Add a function to link sub-surface to its parent. 07/246207/3 accepted/tizen/unified/20201028.123857 submit/tizen/20201028.025427
authorSeunghun Lee <shiin.lee@samsung.com>
Tue, 27 Oct 2020 02:27:16 +0000 (11:27 +0900)
committerSeunghun Lee <shiin.lee@samsung.com>
Tue, 27 Oct 2020 07:16:18 +0000 (16:16 +0900)
no functional change.

Change-Id: Ic683c270587463be3640ff93a278f43daa7c572a

src/bin/e_comp_wl_subsurface.c

index 307ba2e5ca751688c4e25b82097d5e59c77aac2e..f2ba1bb38a1c15104e75821d0bc6316133b96a60 100644 (file)
@@ -15,6 +15,7 @@ static void       _e_comp_wl_subsurface_synchronized_commit(E_Client *ec);
 static void       _e_comp_wl_subsurface_remove_from_parent(E_Client *parent, E_Client *subc);
 static void       _e_comp_wl_subsurface_stack_update(E_Client *ec);
 static Eina_Bool  _e_comp_wl_subsurface_empty_check(E_Client *ec);
+static void       _e_comp_wl_subsurface_parent_link(E_Comp_Wl_Subsurf_Data *sdata, E_Client *subc, E_Client *epc);
 
 static void       _e_comp_wl_subsurface_cb_evas_restack(void *data, Evas *e, Evas_Object *obj, void *event_info);
 
@@ -1026,7 +1027,6 @@ e_comp_wl_subsurface_create(E_Client *ec, E_Client *epc, uint32_t id, struct wl_
    sdata->cached_buffer_ref.buffer = NULL;
    sdata->resource = res;
    sdata->synchronized = EINA_TRUE;
-   sdata->parent = epc;
    sdata->remote_surface.offscreen_parent = offscreen_parent;
 
    /* set subsurface client properties */
@@ -1044,29 +1044,7 @@ e_comp_wl_subsurface_create(E_Client *ec, E_Client *epc, uint32_t id, struct wl_
    if (offscreen_parent)
      ELOGF("COMP", "         |offscreen_parent:%p", ec, offscreen_parent);
 
-   if (epc->frame)
-   {
-       E_Layer layer = e_client_layer_get(epc);
-       if (layer > E_LAYER_BOTTOM) e_client_layer_set(ec, layer);
-
-       if ((!_e_comp_wl_subsurface_data_get(epc)) &&
-           (_e_comp_wl_subsurface_empty_check(epc)))
-         {
-            /* Add a callback function for restacking of topmost. */
-            evas_object_event_callback_add(epc->frame,
-                                           EVAS_CALLBACK_RESTACK,
-                                           _e_comp_wl_subsurface_cb_evas_restack,
-                                           epc);
-         }
-   }
-
-   if (epc->comp_data)
-   {
-       /* append this client to the parents subsurface list */
-       epc->comp_data->sub.list_pending =
-           eina_list_append(epc->comp_data->sub.list_pending, ec);
-       epc->comp_data->sub.list_changed = EINA_TRUE;
-   }
+   _e_comp_wl_subsurface_parent_link(sdata, ec, epc);
 
    /* TODO: add callbacks ?? */
 
@@ -1498,3 +1476,36 @@ _e_comp_wl_subsurface_empty_check(E_Client *ec)
        (eina_list_count(ec->comp_data->sub.below_list) == 0) &&
        (eina_list_count(ec->comp_data->sub.below_list_pending) == 0));
 }
+
+static void
+_e_comp_wl_subsurface_parent_link(E_Comp_Wl_Subsurf_Data *sdata, E_Client *subc, E_Client *epc)
+{
+   E_Layer layer;
+
+   sdata->parent = epc;
+
+   if (epc->frame)
+     {
+        layer = e_client_layer_get(epc);
+        if (layer > E_LAYER_BOTTOM)
+          e_client_layer_set(subc, layer);
+
+        if ((!_e_comp_wl_subsurface_data_get(epc)) &&
+            (_e_comp_wl_subsurface_empty_check(epc)))
+          {
+             /* Add a callback function for restacking of topmost. */
+             evas_object_event_callback_add(epc->frame,
+                                            EVAS_CALLBACK_RESTACK,
+                                            _e_comp_wl_subsurface_cb_evas_restack,
+                                            epc);
+          }
+     }
+
+   if (epc->comp_data)
+     {
+        /* append this client to the parents subsurface list */
+        epc->comp_data->sub.list_pending =
+           eina_list_append(epc->comp_data->sub.list_pending, subc);
+        epc->comp_data->sub.list_changed = EINA_TRUE;
+     }
+}