Revert "subsurface: cleanup and add some logs for below_obj." 47/239047/1
authorSeunghun Lee <shiin.lee@samsung.com>
Tue, 21 Jul 2020 09:44:36 +0000 (18:44 +0900)
committerSeunghun Lee <shiin.lee@samsung.com>
Tue, 21 Jul 2020 09:45:38 +0000 (18:45 +0900)
This reverts commit 19de21428fa12b519199566c3edbe3611603480c.

Change-Id: Ia202cbf29832bc8aeb87a628be18508b79ecaa04

src/bin/e_comp_wl_subsurface.c

index 69c21522b486f20462d5f7d97ddbe6cd8ebe86b2..bfce3eed09bd2875b376ee33b170dea99a99aa53 100644 (file)
@@ -105,65 +105,10 @@ _e_comp_wl_subsurface_video_has(E_Client *ec)
 }
 
 static void
-_e_comp_wl_subsurface_below_obj_create(E_Client *ec)
+_e_comp_wl_subsurface_check_below_bg_rectangle(E_Client *ec)
 {
-   Evas_Object *below_obj;
    short layer;
 
-   /* create a bg rectangle if topmost window is 24 depth window */
-   below_obj = evas_object_rectangle_add(e_comp->evas);
-   EINA_SAFETY_ON_NULL_RETURN(below_obj);
-
-   layer = evas_object_layer_get(ec->frame);
-   evas_object_layer_set(below_obj, layer);
-   evas_object_render_op_set(below_obj, EVAS_RENDER_COPY);
-
-   /* It's more reasonable to use the transparent color instead of black because
-    * we can show the alpha value of the 24 depth topmost window.
-    */
-   evas_object_color_set(below_obj, 0x00, 0x00, 0x00, 0x00);
-   evas_object_move(below_obj, ec->x, ec->y);
-   evas_object_resize(below_obj, ec->w, ec->h);
-   evas_object_name_set(below_obj, "below_bg_rectangle");
-
-   if (evas_object_visible_get(ec->frame))
-     evas_object_show(below_obj);
-
-   ec->comp_data->sub.below_obj = below_obj;
-
-   ELOGF("COMP", "         |bg_rectangle(%p) created", ec, below_obj);
-
-   evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESIZE,
-                                  _e_comp_wl_subsurface_bg_evas_cb_resize, ec);
-
-   /* set alpha only if SW path */
-   e_comp_object_alpha_set(ec->frame, EINA_TRUE);
-
-   /* force update for changing alpha value. if the native surface has been already
-    * set before, changing alpha value can't be applied to egl image.
-    */
-   e_comp_object_native_surface_set(ec->frame, EINA_FALSE);
-   e_pixmap_image_refresh(ec->pixmap);
-   e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h);
-   e_comp_object_dirty(ec->frame);
-   e_comp_object_render(ec->frame);
-
-   _e_comp_wl_subsurface_restack(ec);
-   _e_comp_wl_subsurface_restack_bg_rectangle(ec);
-
-   e_client_transform_core_update(ec);
-}
-
-static void
-_e_comp_wl_subsurface_below_obj_destroy(E_Client *ec)
-{
-   ELOGF("COMP", "         |bg_rectangle(%p) delete", ec, ec->comp_data->sub.below_obj);
-   E_FREE_FUNC(ec->comp_data->sub.below_obj, evas_object_del);
-}
-
-static void
-_e_comp_wl_subsurface_check_below_bg_rectangle(E_Client *ec)
-{
    if (!ec || e_object_is_del(E_OBJECT(ec)) || !ec->comp_data) return;
    if (ec->comp_data->sub.data)
      {
@@ -178,20 +123,59 @@ _e_comp_wl_subsurface_check_below_bg_rectangle(E_Client *ec)
      {
          if (ec->comp_data->sub.below_obj)
            {
-              ELOGF("COMP", "argb ec doesn't need below bg rectangle.", ec);
-              _e_comp_wl_subsurface_below_obj_destroy(ec);
+               ELOGF("COMP", "         |bg_rectangle(%p) delete", ec, ec->comp_data->sub.below_obj);
+               evas_object_del(ec->comp_data->sub.below_obj);
+               ec->comp_data->sub.below_obj = NULL;
            }
          return;
      }
 
    if (!ec->comp_data->sub.below_obj)
      {
-        if ((ec->comp_data->sub.below_list) ||
-            (ec->comp_data->sub.below_list_pending) ||
-            (_e_comp_wl_subsurface_video_has(ec)))
+        if (ec->comp_data->sub.below_list ||
+            ec->comp_data->sub.below_list_pending ||
+            _e_comp_wl_subsurface_video_has(ec))
           {
-             ELOGF("COMP", "it has below subsurfaces and video.", ec);
-             _e_comp_wl_subsurface_below_obj_create(ec);
+             /* create a bg rectangle if topmost window is 24 depth window */
+             ec->comp_data->sub.below_obj = evas_object_rectangle_add(e_comp->evas);
+             EINA_SAFETY_ON_NULL_RETURN(ec->comp_data->sub.below_obj);
+
+             ELOGF("COMP", "         |bg_rectangle(%p) created", ec, ec->comp_data->sub.below_obj);
+
+             layer = evas_object_layer_get(ec->frame);
+             evas_object_layer_set(ec->comp_data->sub.below_obj, layer);
+             evas_object_render_op_set(ec->comp_data->sub.below_obj, EVAS_RENDER_COPY);
+
+             /* It's more reasonable to use the transparent color instead of black because
+              * we can show the alpha value of the 24 depth topmost window.
+              */
+             evas_object_color_set(ec->comp_data->sub.below_obj, 0x00, 0x00, 0x00, 0x00);
+             evas_object_move(ec->comp_data->sub.below_obj, ec->x, ec->y);
+             evas_object_resize(ec->comp_data->sub.below_obj, ec->w, ec->h);
+             evas_object_name_set(ec->comp_data->sub.below_obj, "below_bg_rectangle");
+
+             evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESIZE,
+                                            _e_comp_wl_subsurface_bg_evas_cb_resize, ec);
+
+             /* set alpha only if SW path */
+             e_comp_object_alpha_set(ec->frame, EINA_TRUE);
+
+             /* force update for changing alpha value. if the native surface has been already
+              * set before, changing alpha value can't be applied to egl image.
+              */
+             e_comp_object_native_surface_set(ec->frame, EINA_FALSE);
+             e_pixmap_image_refresh(ec->pixmap);
+             e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h);
+             e_comp_object_dirty(ec->frame);
+             e_comp_object_render(ec->frame);
+
+             _e_comp_wl_subsurface_restack(ec);
+             _e_comp_wl_subsurface_restack_bg_rectangle(ec);
+
+             if (evas_object_visible_get(ec->frame))
+               evas_object_show(ec->comp_data->sub.below_obj);
+
+             e_client_transform_core_update(ec);
           }
      }
    else
@@ -201,9 +185,7 @@ _e_comp_wl_subsurface_check_below_bg_rectangle(E_Client *ec)
             (!ec->comp_data->sub.below_list_pending) &&
             (!_e_comp_wl_subsurface_video_has(ec)))
           {
-              ELOGF("COMP", "it doesn't have any below subsurfaces and video.",
-                    ec);
-             _e_comp_wl_subsurface_below_obj_destroy(ec);
+             E_FREE_FUNC(ec->comp_data->sub.below_obj, evas_object_del);
           }
      }
 }
@@ -767,10 +749,7 @@ _e_comp_wl_subsurface_cb_ec_del(void *data EINA_UNUSED, E_Client *ec)
      _e_comp_wl_subsurface_destroy_sdata(ec);
 
    if (ec->comp_data->sub.below_obj)
-     {
-        ELOGF("COMP", "ec deleted", ec);
-        _e_comp_wl_subsurface_below_obj_destroy(ec);
-     }
+     evas_object_del(ec->comp_data->sub.below_obj);
 
    /* remove sub list */
    /* TODO: if parent is set by onscreen_parent of remote surface? */