Add E_Alpha_Mask_Rect 87/310187/1
authorSeunghun Lee <shiin.lee@samsung.com>
Wed, 27 Mar 2024 10:26:41 +0000 (19:26 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Wed, 24 Apr 2024 00:57:55 +0000 (09:57 +0900)
This separates out the implementation of 'below rectangle object' from
e_comp_wl_subsurface to enhance maintainability.
As a result, the previous member fields associated with the below
rectangle object have become obsolete, and the E_Client structure should
no longer contain references to them.

Change-Id: I0be206c4b8d5d4c5798157d8b6ec0c24403379af

src/bin/Makefile.mk
src/bin/e_alpha_mask_rect.c [new file with mode: 0644]
src/bin/e_alpha_mask_rect_intern.h [new file with mode: 0644]
src/bin/e_comp_wl.c
src/bin/e_comp_wl_subsurface.c
src/bin/e_comp_wl_subsurface_intern.h
src/bin/e_desk_area.c
src/bin/e_info_server.c
src/include/e_comp_wl.h

index b4774ab..582c0b2 100644 (file)
@@ -246,7 +246,8 @@ src/bin/e_subsurface_watcher.c \
 src/bin/e_tbm_gbm_server.c \
 src/bin/e_comp_input.c \
 src/bin/e_linux_dmabuf.c \
-src/bin/e_input_thread_client.c
+src/bin/e_input_thread_client.c \
+src/bin/e_alpha_mask_rect.c
 
 src_bin_enlightenment_CPPFLAGS = $(E_CPPFLAGS) -DEFL_BETA_API_SUPPORT -DEFL_EO_API_SUPPORT -DE_LOGGING=2 @WAYLAND_CFLAGS@ $(TTRACE_CFLAGS) $(DLOG_CFLAGS) $(PIXMAN_CFLAGS) $(POLICY_CFLAGS) $(EGL_CFLAGS)
 if HAVE_LIBGOMP
diff --git a/src/bin/e_alpha_mask_rect.c b/src/bin/e_alpha_mask_rect.c
new file mode 100644 (file)
index 0000000..67c709d
--- /dev/null
@@ -0,0 +1,297 @@
+#include <wayland-server.h>
+#include <Evas.h>
+
+#include "e_alpha_mask_rect_intern.h"
+#include "e_client_intern.h"
+#include "e_comp_wl_subsurface_intern.h"
+#include "e_comp_object_intern.h"
+#include "e_map_intern.h"
+
+struct _E_Alpha_Mask_Rect
+{
+   Evas_Object *eo;
+   E_Map *map;
+   E_Client *ec;
+   E_Comp_Wl_Hook *subsurface_create_hook;
+
+   struct wl_listener destroy;
+   struct wl_listener transform_change;
+};
+
+static void _e_alpha_mask_rect_destroy(E_Alpha_Mask_Rect *rect);
+
+static void
+_e_alpha_mask_rect_cb_client_destroy(struct wl_listener *listener, void *data)
+{
+   E_Alpha_Mask_Rect *rect = wl_container_of(listener, rect, destroy);
+   _e_alpha_mask_rect_destroy(rect);
+}
+
+static void
+_e_alpha_mask_rect_map_apply(E_Alpha_Mask_Rect *rect)
+{
+   E_Map *map = NULL, *new_map = NULL;
+   Eina_Bool enable;
+   int w, h;
+
+   e_map_util_points_populate_from_object_full(rect->map, rect->ec->frame, 0);
+
+   evas_object_geometry_get(rect->eo, NULL, NULL, &w, &h);
+   e_map_point_image_uv_set(rect->map, 0, 0, 0);
+   e_map_point_image_uv_set(rect->map, 1, w, 0);
+   e_map_point_image_uv_set(rect->map, 2, w, h);
+   e_map_point_image_uv_set(rect->map, 3, 0, h);
+
+   enable = e_client_transform_core_enable_get(rect->ec);
+   if (enable)
+     map = e_comp_object_map_get(rect->ec->frame);
+
+   if ((enable) && (map))
+     {
+        new_map = e_map_dup(map);
+        if (!new_map)
+          {
+             ERR("fail to dup e_map ec:%p", rect->ec);
+             e_map_free(map);
+             return;
+          }
+
+        e_map_point_image_uv_set(new_map, 0, 0, 0);
+        e_map_point_image_uv_set(new_map, 1, w, 0);
+        e_map_point_image_uv_set(new_map, 2, w, h);
+        e_map_point_image_uv_set(new_map, 3, 0, h);
+
+        e_comp_object_map_set(rect->eo, new_map);
+        e_comp_object_map_enable_set(rect->eo, EINA_TRUE);
+        e_map_free(new_map);
+     }
+   else
+     {
+        e_comp_object_map_set(rect->eo, rect->map);
+        e_comp_object_map_enable_set(rect->eo, EINA_TRUE);
+     }
+
+    if (map) e_map_free(map);
+}
+
+static void
+_e_alpha_mask_rect_cb_frame_show(void *data, Evas *evas EINA_UNUSED, Evas_Object *eo EINA_UNUSED, void *event EINA_UNUSED)
+{
+   E_Alpha_Mask_Rect *rect = data;
+
+   evas_object_show(rect->eo);
+}
+
+static void
+_e_alpha_mask_rect_cb_frame_hide(void *data, Evas *evas EINA_UNUSED, Evas_Object *eo EINA_UNUSED, void *event EINA_UNUSED)
+{
+   E_Alpha_Mask_Rect *rect = data;
+
+   evas_object_hide(rect->eo);
+}
+
+static void
+_e_alpha_mask_rect_cb_frame_move(void *data, Evas *evas EINA_UNUSED, Evas_Object *eo EINA_UNUSED, void *event EINA_UNUSED)
+{
+   E_Alpha_Mask_Rect *rect = data;
+
+   evas_object_move(rect->eo, rect->ec->x, rect->ec->y);
+   _e_alpha_mask_rect_map_apply(rect);
+}
+
+static void
+_e_alpha_mask_rect_cb_frame_resize(void *data, Evas *evas EINA_UNUSED, Evas_Object *eo EINA_UNUSED, void *event EINA_UNUSED)
+{
+   E_Alpha_Mask_Rect *rect = data;
+
+   _e_alpha_mask_rect_map_apply(rect);
+}
+
+static void
+_e_alpha_mask_rect_cb_client_resize(void *data, Evas_Object *eo EINA_UNUSED, void *event EINA_UNUSED)
+{
+   E_Alpha_Mask_Rect *rect = data;
+
+   _e_alpha_mask_rect_map_apply(rect);
+}
+
+static void
+_e_alpha_mask_rect_cb_transform_change(struct wl_listener *listener, void *data)
+{
+   E_Alpha_Mask_Rect *rect = wl_container_of(listener, rect, transform_change);
+
+   _e_alpha_mask_rect_map_apply(rect);
+}
+
+static void
+_e_alpha_mask_rect_cb_subsurface_create(void *data, E_Client *ec)
+{
+   E_Alpha_Mask_Rect *rect = data;
+
+   if (rect->ec != ec)
+     return;
+
+   _e_alpha_mask_rect_destroy(rect);
+}
+
+static E_Alpha_Mask_Rect *
+_e_alpha_mask_rect_try_from_ec(E_Client *ec)
+{
+   E_Alpha_Mask_Rect *rect;
+   struct wl_listener *listener;
+
+   listener = e_client_destroy_listener_get(ec, _e_alpha_mask_rect_cb_client_destroy);
+   if (!listener)
+     return NULL;
+
+   return wl_container_of(listener, rect, destroy);
+}
+
+static void
+_e_alpha_mask_rect_destroy(E_Alpha_Mask_Rect *rect)
+{
+   ELOGF("ALPHA_MASK", "Destroy E_Alpha_Mask_Rect(%p)", rect->ec, rect);
+
+   e_comp_wl_hook_del(rect->subsurface_create_hook);
+   evas_object_smart_callback_del(rect->ec->frame, "client_resize", _e_alpha_mask_rect_cb_client_resize);
+   evas_object_event_callback_del(rect->ec->frame, EVAS_CALLBACK_SHOW, _e_alpha_mask_rect_cb_frame_show);
+   evas_object_event_callback_del(rect->ec->frame, EVAS_CALLBACK_HIDE, _e_alpha_mask_rect_cb_frame_hide);
+   evas_object_event_callback_del(rect->ec->frame, EVAS_CALLBACK_MOVE, _e_alpha_mask_rect_cb_frame_move);
+   evas_object_event_callback_del(rect->ec->frame, EVAS_CALLBACK_RESIZE, _e_alpha_mask_rect_cb_frame_resize);
+   evas_object_del(rect->eo);
+   e_map_free(rect->map);
+   wl_list_remove(&rect->transform_change.link);
+   wl_list_remove(&rect->destroy.link);
+   free(rect);
+}
+
+EINTERN E_Alpha_Mask_Rect *
+e_alpha_mask_rect_create(E_Client *ec)
+{
+   E_Alpha_Mask_Rect *rect;
+   short layer;
+
+   rect = E_NEW(E_Alpha_Mask_Rect, 1);
+   if (!rect)
+     return NULL;
+
+   rect->eo = evas_object_rectangle_add(e_comp->evas);
+   if (!rect->eo)
+     {
+        free(rect);
+        return NULL;
+     }
+
+   rect->map = e_map_new();
+   if (!rect->map)
+     {
+        ERR("Failed to new e_map ec:%p", ec);
+        evas_object_del(rect->eo);
+        free(rect);
+        return NULL;
+     }
+
+   /* This object doesn't care about mouse event. And It's also
+    * to avoid events of mouse on the E_Client. */
+   evas_object_pass_events_set(rect->eo, EINA_TRUE);
+
+   layer = evas_object_layer_get(ec->frame);
+   evas_object_layer_set(rect->eo, layer);
+   evas_object_render_op_set(rect->eo, 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(rect->eo, 0x00, 0x00, 0x00, 0x00);
+   evas_object_move(rect->eo, ec->x, ec->y);
+   evas_object_resize(rect->eo, 1, 1);
+   evas_object_name_set(rect->eo, "below_bg_rectangle");
+
+   rect->ec = ec;
+
+   rect->destroy.notify = _e_alpha_mask_rect_cb_client_destroy;
+   e_client_destroy_listener_add(ec, &rect->destroy);
+
+   rect->transform_change.notify = _e_alpha_mask_rect_cb_transform_change;
+   e_client_transform_change_listener_add(ec, &rect->transform_change);
+
+   _e_alpha_mask_rect_map_apply(rect);
+
+   if (evas_object_visible_get(ec->frame))
+     evas_object_show(rect->eo);
+
+   evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_SHOW, _e_alpha_mask_rect_cb_frame_show, rect);
+   evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_HIDE, _e_alpha_mask_rect_cb_frame_hide, rect);
+   evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_MOVE, _e_alpha_mask_rect_cb_frame_move, rect);
+   evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESIZE, _e_alpha_mask_rect_cb_frame_resize, rect);
+   evas_object_smart_callback_add(ec->frame, "client_resize", _e_alpha_mask_rect_cb_client_resize, rect);
+
+   rect->subsurface_create_hook = e_comp_wl_hook_add(E_COMP_WL_HOOK_SUBSURFACE_CREATE, _e_alpha_mask_rect_cb_subsurface_create, rect);
+
+   /* 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_alpha_mask_rect_restack(rect);
+
+   /* 'below_obj' has to be transformed according to ec's transformation.
+    * that's the reason invoking 'transform_core_update()' here. */
+   e_client_transform_core_update(ec);
+
+   ELOGF("ALPHA_MASK", "Created E_Alpha_Mask_Rect(%p)", ec, rect);
+
+   return rect;
+}
+
+EINTERN void
+e_alpha_mask_rect_destroy(E_Alpha_Mask_Rect *rect)
+{
+   EINA_SAFETY_ON_NULL_RETURN(rect);
+
+   _e_alpha_mask_rect_destroy(rect);
+}
+
+EINTERN E_Alpha_Mask_Rect *
+e_alpha_mask_rect_try_from_ec(E_Client *ec)
+{
+   E_Alpha_Mask_Rect *rect;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
+
+   rect = _e_alpha_mask_rect_try_from_ec(ec);
+
+   return rect;
+}
+
+EINTERN void
+e_alpha_mask_rect_restack(E_Alpha_Mask_Rect *rect)
+{
+   E_Client *bottom = rect->ec;
+
+   while (bottom)
+     {
+        short layer = evas_object_layer_get(bottom->frame);
+
+        if (evas_object_layer_get(rect->eo) != layer)
+          evas_object_layer_set(rect->eo, layer);
+
+        evas_object_stack_below(rect->eo, bottom->frame);
+        bottom = eina_list_nth(bottom->comp_data->sub.below_list, 0);
+     }
+}
+
+EINTERN Evas_Object *
+e_alpha_mask_rect_evas_object_get(E_Alpha_Mask_Rect *rect)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(rect, NULL);
+   return rect->eo;
+}
diff --git a/src/bin/e_alpha_mask_rect_intern.h b/src/bin/e_alpha_mask_rect_intern.h
new file mode 100644 (file)
index 0000000..fd9c98b
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef E_ALPHA_MASK_RECT_INTERN_H
+#define E_ALPHA_MASK_RECT_INTERN_H
+
+#include <Evas.h>
+#include "e_client.h"
+
+struct _E_Alpha_Mask_Rect;
+typedef struct _E_Alpha_Mask_Rect E_Alpha_Mask_Rect;
+
+E_Alpha_Mask_Rect *e_alpha_mask_rect_create(E_Client *ec);
+void e_alpha_mask_rect_destroy(E_Alpha_Mask_Rect *rect);
+E_Alpha_Mask_Rect *e_alpha_mask_rect_try_from_ec(E_Client *ec);
+Evas_Object *e_alpha_mask_rect_evas_object_get(E_Alpha_Mask_Rect *rect);
+void e_alpha_mask_rect_restack(E_Alpha_Mask_Rect *rect);
+
+#endif
index 5822fd6..b9a4e10 100644 (file)
@@ -738,9 +738,6 @@ _e_comp_wl_evas_cb_show(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EIN
    topmost = e_comp_wl_topmost_parent_get(ec);
    if (topmost == ec && (ec->comp_data->sub.list || ec->comp_data->sub.below_list))
      e_comp_wl_subsurface_show(ec);
-
-   if (ec->comp_data->sub.below_obj)
-     evas_object_show(ec->comp_data->sub.below_obj);
 }
 
 static void
@@ -768,9 +765,6 @@ _e_comp_wl_evas_cb_hide(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EIN
    if (topmost == ec && (ec->comp_data->sub.list || ec->comp_data->sub.below_list))
      e_comp_wl_subsurface_hide(ec);
 
-   if (ec->comp_data->sub.below_obj)
-     evas_object_hide(ec->comp_data->sub.below_obj);
-
    wl_signal_emit(&e_comp_wl->ptr_constraints.surface_unmap_signal, ec);
 }
 
@@ -806,12 +800,6 @@ _e_comp_wl_evas_cb_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_U
         if (cdata->viewport_transform)
           e_comp_wl_map_apply(subc);
      }
-
-   if (ec->comp_data->sub.below_obj)
-     {
-        evas_object_move(ec->comp_data->sub.below_obj, ec->x, ec->y);
-        e_comp_wl_subsurface_bg_rectangle_map_apply(ec);
-     }
 }
 
 static void
@@ -2750,24 +2738,11 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
 
              e_client_hide(ec);
           }
-
-        if ((cdata->sub.below_obj) &&
-            (evas_object_visible_get(cdata->sub.below_obj)))
-          {
-             evas_object_hide(cdata->sub.below_obj);
-          }
      }
    else
      {
         /* map ec */
         e_client_show(ec);
-
-        if ((cdata->sub.below_obj) &&
-            (!evas_object_visible_get(cdata->sub.below_obj)) &&
-            (evas_object_visible_get(ec->frame)))
-          {
-             evas_object_show(cdata->sub.below_obj);
-          }
      }
 
    if ((state->new_attach) ||
@@ -2950,7 +2925,7 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
         eina_tiler_clear(state->input);
      }
 
-   e_comp_wl_subsurface_check_below_bg_rectangle(ec);
+   e_comp_wl_subsurface_check_alpha_mask_rect(ec);
 
    if ((cdata->video_client) &&
        ((buffer) &&
@@ -5831,10 +5806,6 @@ _e_comp_wl_client_subsurface_set(E_Client *ec, E_Comp_Wl_Subsurf_Data *sub)
    ec->new_client = ec->netwm.ping = EINA_TRUE;
    e_comp->new_clients++;
    e_client_unignore(ec);
-
-   /* Delete 'below_obj' if it was created before 'E_Client' becomes subsurface.
-    * It's not for subsurface. */
-   E_FREE_FUNC(ec->comp_data->sub.below_obj, evas_object_del);
 }
 
 static void
index 2dbcd28..8774475 100644 (file)
@@ -5,6 +5,7 @@
 #include "e_client_video_intern.h"
 #include "e_client_intern.h"
 #include "e_comp_object_intern.h"
+#include "e_alpha_mask_rect_intern.h"
 
 #include <tizen-extension-server-protocol.h>
 
@@ -16,7 +17,6 @@ static E_Comp_Wl_Subsurf_Data *_e_comp_wl_subsurface_data_get(E_Client *ec);
 static void       _e_comp_wl_subsurface_commit_to_cache(E_Client *ec);
 static void       _e_comp_wl_subsurface_commit_from_cache(E_Client *ec);
 static void       _e_comp_wl_subsurface_stack_update(E_Client *ec);
-static void       _e_comp_wl_subsurface_below_obj_destroy(E_Client *ec);
 
 EINTERN void
 e_comp_wl_client_subsurface_commit_to_cache(E_Client *ec)
@@ -31,29 +31,6 @@ e_comp_wl_client_subsurface_commit_from_cache(E_Client *ec)
 }
 
 static void
-_e_comp_wl_subsurface_restack_bg_rectangle(E_Client *ec)
-{
-   E_Client *bottom = ec;
-
-   if (!ec || !ec->comp_data || e_object_is_del(E_OBJECT(ec)))
-     return;
-
-   if (!ec->comp_data->sub.below_obj)
-     return;
-
-   while (bottom)
-     {
-        short layer = evas_object_layer_get(bottom->frame);
-
-        if (evas_object_layer_get(ec->comp_data->sub.below_obj) != layer)
-          evas_object_layer_set(ec->comp_data->sub.below_obj, layer);
-
-        evas_object_stack_below(ec->comp_data->sub.below_obj, bottom->frame);
-        bottom = eina_list_nth(bottom->comp_data->sub.below_list, 0);
-     }
-}
-
-static void
 _e_comp_wl_subsurface_restack(E_Client *ec)
 {
    E_Client *subc, *temp;
@@ -88,89 +65,6 @@ _e_comp_wl_subsurface_restack(E_Client *ec)
      _e_comp_wl_subsurface_restack(subc);
 }
 
-EINTERN void
-e_comp_wl_subsurface_bg_rectangle_map_apply(E_Client *ec)
-{
-   E_Map *map = NULL, *new_map = NULL;
-   Eina_Bool enable;
-   int w, h;
-
-   if (e_object_is_del(E_OBJECT(ec))) return;
-   if (!ec->comp_data) return;
-   if (!ec->comp_data->sub.below_obj) return;
-   if (!ec->comp_data->sub.below_obj_map) return;
-
-   e_map_util_points_populate_from_object_full(ec->comp_data->sub.below_obj_map, ec->frame, 0);
-
-   evas_object_geometry_get(ec->comp_data->sub.below_obj, NULL, NULL, &w, &h);
-   e_map_point_image_uv_set(ec->comp_data->sub.below_obj_map, 0, 0, 0);
-   e_map_point_image_uv_set(ec->comp_data->sub.below_obj_map, 1, w, 0);
-   e_map_point_image_uv_set(ec->comp_data->sub.below_obj_map, 2, w, h);
-   e_map_point_image_uv_set(ec->comp_data->sub.below_obj_map, 3, 0, h);
-
-   enable = e_client_transform_core_enable_get(ec);
-   if (enable)
-     map = e_comp_object_map_get(ec->frame);
-
-   if ((enable) && (map))
-     {
-        new_map = e_map_dup(map);
-        if (!new_map)
-          {
-             ERR("fail to dup e_map ec:%p", ec);
-             e_map_free(map);
-             return;
-          }
-
-        e_map_point_image_uv_set(new_map, 0, 0, 0);
-        e_map_point_image_uv_set(new_map, 1, w, 0);
-        e_map_point_image_uv_set(new_map, 2, w, h);
-        e_map_point_image_uv_set(new_map, 3, 0, h);
-
-        e_comp_object_map_set(ec->comp_data->sub.below_obj, new_map);
-        e_comp_object_map_enable_set(ec->comp_data->sub.below_obj, EINA_TRUE);
-        e_map_free(new_map);
-     }
-   else
-     {
-        e_comp_object_map_set(ec->comp_data->sub.below_obj, ec->comp_data->sub.below_obj_map);
-        e_comp_object_map_enable_set(ec->comp_data->sub.below_obj, EINA_TRUE);
-     }
-
-    if (map) e_map_free(map);
-}
-
-static void
-_e_comp_wl_subsurface_bg_evas_cb_resize(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
-{
-   E_Client *ec;
-
-   if (!(ec = data)) return;
-
-   e_comp_wl_subsurface_bg_rectangle_map_apply(ec);
-}
-
-static void
-_e_comp_wl_subsurface_bg_cb_hook_transform_change(void *data, E_Client *ec)
-{
-   e_comp_wl_subsurface_bg_rectangle_map_apply(ec);
-}
-
-static void
-_e_comp_wl_subsurface_bg_cb_hook_del(void *data, E_Client *ec)
-{
-   if (!ec) return;
-
-   if (ec->comp_data)
-     {
-        if (ec->comp_data->sub.below_obj)
-          {
-             ELOGF("COMP", "below_obj becomes useless by destroyed ec. argb(%d)", ec, ec->argb);
-             _e_comp_wl_subsurface_below_obj_destroy(ec);
-          }
-     }
-}
-
 static Eina_Bool
 _e_comp_wl_subsurface_video_has(E_Client *ec)
 {
@@ -204,104 +98,10 @@ _e_comp_wl_subsurface_video_has(E_Client *ec)
 }
 
 static void
-_e_comp_wl_subsurface_below_obj_create(E_Client *ec)
-{
-   Evas_Object *below_obj;
-   E_Map *below_obj_map;
-   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);
-
-   below_obj_map = e_map_new();
-   if (!below_obj_map)
-     {
-        ERR("Failed to new e_map ec:%p", ec);
-        evas_object_del(below_obj);
-        return;
-     }
-
-   /* This object doesn't care about mouse event. And It's also
-    * to avoid events of mouse on the E_Client. */
-   evas_object_pass_events_set(below_obj, EINA_TRUE);
-
-   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, 1, 1);
-   evas_object_name_set(below_obj, "below_bg_rectangle");
-
-   ec->comp_data->sub.below_obj = below_obj;
-
-   ec->comp_data->sub.below_obj_map = below_obj_map;
-   ec->comp_data->sub.below_obj_map_transform_hook =
-      e_client_hook_add(E_CLIENT_HOOK_TRANSFORM_CHANGE,
-                        _e_comp_wl_subsurface_bg_cb_hook_transform_change,
-                        ec);
-   ec->comp_data->sub.comp_wl_del_hook =
-      e_comp_wl_hook_add(E_COMP_WL_HOOK_DEL,
-                         _e_comp_wl_subsurface_bg_cb_hook_del,
-                         ec);
-
-   e_comp_wl_subsurface_bg_rectangle_map_apply(ec);
-
-   if (evas_object_visible_get(ec->frame))
-     evas_object_show(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);
-
-   /* 'below_obj' has to be transformed according to ec's transformation.
-    * that's the reason invoking 'transform_core_update()' here. */
-   e_client_transform_core_update(ec);
-}
-
-static void
-_e_comp_wl_subsurface_below_obj_destroy(E_Client *ec)
-{
-   if (!ec->comp_data) return;
-
-   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);
-
-   if (ec->comp_data->sub.below_obj_map)
-     {
-        e_map_free(ec->comp_data->sub.below_obj_map);
-        ec->comp_data->sub.below_obj_map = NULL;
-     }
-   E_FREE_FUNC(ec->comp_data->sub.below_obj_map_transform_hook, e_client_hook_del);
-   E_FREE_FUNC(ec->comp_data->sub.comp_wl_del_hook, e_comp_wl_hook_del);
-}
-
-static void
-_e_comp_wl_subsurface_check_below_bg_rectangle(E_Client *ec)
+_e_comp_wl_subsurface_check_alpha_mask_rect(E_Client *ec)
 {
    E_Client *topmost;
+   E_Alpha_Mask_Rect *rect;
 
    topmost = e_comp_wl_topmost_parent_get(ec);
    if (!topmost)
@@ -314,7 +114,8 @@ _e_comp_wl_subsurface_check_below_bg_rectangle(E_Client *ec)
    if (_e_comp_wl_subsurface_data_get(topmost))
      return;
 
-   if (topmost->comp_data->sub.below_obj)
+   rect = e_alpha_mask_rect_try_from_ec(topmost);
+   if (rect)
      {
         if ((topmost->argb) ||
             ((!topmost->comp_data->sub.below_list) &&
@@ -323,7 +124,7 @@ _e_comp_wl_subsurface_check_below_bg_rectangle(E_Client *ec)
           {
              ELOGF("COMP", "below_obj becomes useless. argb(%d)",
                    topmost, topmost->argb);
-             _e_comp_wl_subsurface_below_obj_destroy(topmost);
+             e_alpha_mask_rect_destroy(rect);
           }
      }
    else
@@ -334,7 +135,7 @@ _e_comp_wl_subsurface_check_below_bg_rectangle(E_Client *ec)
              (_e_comp_wl_subsurface_video_has(topmost))))
           {
              ELOGF("COMP", "it has below subsurfaces and video.", topmost);
-             _e_comp_wl_subsurface_below_obj_create(topmost);
+             e_alpha_mask_rect_create(topmost);
           }
      }
 }
@@ -561,6 +362,7 @@ static void
 _e_comp_wl_subsurface_commit_from_cache(E_Client *ec)
 {
    E_Comp_Wl_Subsurf_Data *sdata;
+   E_Alpha_Mask_Rect *rect;
 
    sdata = _e_comp_wl_subsurface_data_get(ec);
    EINA_SAFETY_ON_NULL_RETURN(sdata);
@@ -582,7 +384,10 @@ _e_comp_wl_subsurface_commit_from_cache(E_Client *ec)
      {
         E_Client *topmost = e_comp_wl_topmost_parent_get(ec);
         _e_comp_wl_subsurface_restack(topmost);
-        _e_comp_wl_subsurface_restack_bg_rectangle(topmost);
+
+        rect = e_alpha_mask_rect_try_from_ec(topmost);
+        if (rect)
+          e_alpha_mask_rect_restack(rect);
      }
 
    sdata->cached.has_data = EINA_FALSE;
@@ -760,9 +565,13 @@ e_comp_wl_subsurface_hide(E_Client *ec)
 EINTERN void
 e_comp_wl_subsurface_restack_bg_rectangle(E_Client *ec)
 {
+   E_Alpha_Mask_Rect *rect;
+
    EINA_SAFETY_ON_NULL_RETURN(ec);
 
-   _e_comp_wl_subsurface_restack_bg_rectangle(ec);
+   rect = e_alpha_mask_rect_try_from_ec(ec);
+   if (rect)
+     e_alpha_mask_rect_restack(rect);
 }
 
 EINTERN void
@@ -832,14 +641,14 @@ e_comp_wl_normal_subsurface_has(E_Client *ec)
 }
 
 EINTERN void
-e_comp_wl_subsurface_check_below_bg_rectangle(E_Client *ec)
+e_comp_wl_subsurface_check_alpha_mask_rect(E_Client *ec)
 {
    EINA_SAFETY_ON_NULL_RETURN(ec);
 
    if ((e_object_is_del(E_OBJECT(ec))) || (!ec->comp_data))
      return;
 
-   _e_comp_wl_subsurface_check_below_bg_rectangle(ec);
+   _e_comp_wl_subsurface_check_alpha_mask_rect(ec);
 }
 
 EINTERN Eina_Bool
@@ -937,6 +746,7 @@ static void
 _e_comp_wl_subsurface_stack_update(E_Client *ec)
 {
    E_Client *topmost;
+   E_Alpha_Mask_Rect *rect;
 
    if (!ec->comp_data) return;
    if (e_object_is_del(E_OBJECT(ec))) return;
@@ -945,15 +755,19 @@ _e_comp_wl_subsurface_stack_update(E_Client *ec)
    /* return if ec isn't both a parent of a subsurface and a subsurface itself */
    if (!ec->comp_data->sub.list && !ec->comp_data->sub.below_list && !ec->comp_data->sub.data)
      {
-        if (ec->comp_data->sub.below_obj)
-          _e_comp_wl_subsurface_restack_bg_rectangle(ec);
+        rect = e_alpha_mask_rect_try_from_ec(ec);
+        if (rect)
+          e_alpha_mask_rect_restack(rect);
         return;
      }
 
    topmost = e_comp_wl_topmost_parent_get(ec);
 
    _e_comp_wl_subsurface_restack(topmost);
-   _e_comp_wl_subsurface_restack_bg_rectangle(topmost);
+
+   rect = e_alpha_mask_rect_try_from_ec(topmost);
+   if (rect)
+     e_alpha_mask_rect_restack(rect);
 
    e_client_subsurface_stack_update(ec);
 }
index 07af4ef..88acc87 100644 (file)
@@ -28,12 +28,11 @@ EINTERN void          e_comp_wl_subsurface_restack_bg_rectangle(E_Client *ec);
 EINTERN void          e_comp_wl_subsurface_restack(E_Client *ec);
 EINTERN Eina_Bool     e_comp_wl_video_subsurface_has(E_Client *ec);
 EINTERN Eina_Bool     e_comp_wl_normal_subsurface_has(E_Client *ec);
-EINTERN void          e_comp_wl_subsurface_check_below_bg_rectangle(E_Client *ec);
+EINTERN void          e_comp_wl_subsurface_check_alpha_mask_rect(E_Client *ec);
 EINTERN Eina_Bool     e_comp_wl_subsurface_check(E_Client *ec);
 EINTERN E_Client     *e_comp_wl_subsurface_parent_get(E_Client *ec);
 EINTERN Eina_Bool     e_comp_wl_subsurface_stand_alone_mode_get(E_Client *ec);
 EINTERN Eina_Bool     e_comp_wl_subsurface_position_get(E_Client *ec, int *x, int *y);
 EINTERN Eina_Bool     e_comp_wl_subsurface_global_coord_get(E_Client *ec, int *x, int *y);
-EINTERN void          e_comp_wl_subsurface_bg_rectangle_map_apply(E_Client *ec);
 
 #endif
index 23860a5..f2d94e8 100644 (file)
@@ -2194,9 +2194,6 @@ _desk_area_cb_comp_object_resize(struct wl_listener *listener, void *data)
              _e_desk_area_configure_send(ec, 1, 1);
           }
      }
-
-   if (ec->comp_data->sub.below_obj)
-     e_comp_wl_subsurface_bg_rectangle_map_apply(ec);
 }
 
 static void
index f94932b..026b51e 100644 (file)
@@ -37,6 +37,7 @@
 #include "e_dbus_conn_intern.h"
 #include "e_hints_intern.h"
 #include "e_comp_input_intern.h"
+#include "e_alpha_mask_rect_intern.h"
 
 #include <tbm_bufmgr.h>
 #include <tbm_surface.h>
@@ -3047,7 +3048,8 @@ _e_info_server_cb_subsurface(const Eldbus_Service_Interface *iface EINA_UNUSED,
         unsigned int buf_id = 0;
         int x = 0, y = 0, w = 0, h = 0;
         unsigned int transform = 0, visible = 0, alpha = 0, ignore = 0, maskobj = 0, video = 0, stand = 0;
-        Ecore_Window bgrect = 0;
+        E_Alpha_Mask_Rect *mask_rect;
+        Ecore_Window mask_rect_object = 0;
         const char *name = NULL;
         E_Comp_Wl_Buffer *buffer;
         E_Map *map;
@@ -3096,8 +3098,9 @@ _e_info_server_cb_subsurface(const Eldbus_Service_Interface *iface EINA_UNUSED,
              visible = evas_object_visible_get(o);
              alpha = e_comp_object_alpha_get(ec->frame);
              ignore = e_client_util_ignored_get(ec);
-             if (ec->comp_data->sub.below_obj)
-               bgrect = (Ecore_Window)ec->comp_data->sub.below_obj;
+             mask_rect = e_alpha_mask_rect_try_from_ec(ec);
+             if (mask_rect)
+               mask_rect_object = (Ecore_Window)e_alpha_mask_rect_evas_object_get(mask_rect);
              maskobj = e_comp_object_mask_has(ec->frame);
              video = (ec->comp_data->video_client || e_client_video_hw_composition_check(ec)) ? 1 : 0;
              name = e_client_util_name_get(ec);
@@ -3109,7 +3112,7 @@ _e_info_server_cb_subsurface(const Eldbus_Service_Interface *iface EINA_UNUSED,
 
         eldbus_message_iter_arguments_append
            (struct_of_ec, SIGNATURE_SUBSURFACE,
-            win, parent, buf_id, x, y, w, h, transform, visible, alpha, ignore, maskobj, video, stand, bgrect, name);
+            win, parent, buf_id, x, y, w, h, transform, visible, alpha, ignore, maskobj, video, stand, mask_rect_object, name);
 
         eldbus_message_iter_container_close(array_of_ec, struct_of_ec);
      }
index da10275..d2950a5 100644 (file)
@@ -420,10 +420,10 @@ struct _E_Comp_Wl_Client_Data
 
         Eina_List *below_list;
         Eina_List *below_list_pending;
-        Evas_Object *below_obj;
-        E_Map *below_obj_map;
-        E_Client_Hook *below_obj_map_transform_hook;
-        E_Comp_Wl_Hook *comp_wl_del_hook;
+        EINA_DEPRECATED Evas_Object *below_obj;
+        EINA_DEPRECATED E_Map *below_obj_map;
+        EINA_DEPRECATED E_Client_Hook *below_obj_map_transform_hook;
+        EINA_DEPRECATED E_Comp_Wl_Hook *comp_wl_del_hook;
 
         Eina_Bool restacking : 1;
      } sub;