Revert "Revert "e_comp_object: make the frame object transparent when it is unredirec... 22/292822/1
authorChangyeon Lee <cyeon.lee@samsung.com>
Mon, 15 May 2023 03:07:47 +0000 (12:07 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Mon, 15 May 2023 08:57:31 +0000 (17:57 +0900)
This reverts commit 521314d7db521047cb2e2aaff06b450046e12e36.

e_comp_object_color_get return user_color of trasnparent if transparent is set

Change-Id: Ic465c0d141994a08ec9684abf6257a8ece77d89e

src/bin/e_comp_object.c

index 595fde5..0aba85b 100644 (file)
@@ -177,6 +177,15 @@ typedef struct _E_Comp_Object
         Eina_Bool            pending_resize_set;
         int                  pending_resize_w, pending_resize_h;
      } render_update_lock;
+
+   struct
+     {
+        Eina_Bool        set;
+        int              user_r;
+        int              user_g;
+        int              user_b;
+        int              user_a;
+     } transparent;
 } E_Comp_Object;
 
 typedef struct _E_Input_Rect_Data
@@ -2778,6 +2787,30 @@ _e_comp_intercept_focus(void *data, Evas_Object *obj, Eina_Bool focus)
    evas_object_focus_set(obj, focus);
 }
 
+static void
+_e_comp_intercept_color_set(void *data, Evas_Object *obj, int r, int g, int b, int a)
+{
+   E_Comp_Object *cw = data;
+
+   if (cw->transparent.set)
+     {
+        cw->transparent.user_r = r;
+        cw->transparent.user_g = g;
+        cw->transparent.user_b = b;
+        cw->transparent.user_a = a;
+
+        ELOGF("COMP", "Transparent user_color(%d,%d,%d,%d)",
+              cw->ec,
+              cw->transparent.user_r,
+              cw->transparent.user_g,
+              cw->transparent.user_b,
+              cw->transparent.user_a);
+     }
+   else
+     {
+        evas_object_color_set(obj, r, g, b, a);
+     }
+}
 ////////////////////////////////////////////////////
 
 static void
@@ -3201,6 +3234,7 @@ _e_comp_smart_add(Evas_Object *obj)
    evas_object_intercept_show_callback_add(obj, _e_comp_intercept_show, cw);
    evas_object_intercept_hide_callback_add(obj, _e_comp_intercept_hide, cw);
    evas_object_intercept_focus_set_callback_add(obj, _e_comp_intercept_focus, cw);
+   evas_object_intercept_color_set_callback_add(obj, _e_comp_intercept_color_set, cw);
 
    evas_object_smart_callback_add(obj, "shading", _e_comp_smart_cb_shading, cw);
    evas_object_smart_callback_add(obj, "shaded", _e_comp_smart_cb_shaded, cw);
@@ -4755,6 +4789,56 @@ _e_comp_object_clear(E_Comp_Object *cw)
    e_comp_object_render_update_del(cw->smart_obj);
 }
 
+static Eina_Bool
+_e_comp_object_transparent_set(Evas_Object *obj, Eina_Bool set)
+{
+    int r, g, b, a;
+
+    API_ENTRY EINA_FALSE;
+
+    if (cw->transparent.set == set)
+       return EINA_TRUE;
+
+    if (set)
+      {
+         evas_object_color_get(obj, &r, &g, &b, &a);
+         evas_object_color_set(obj, 0, 0, 0, 0);
+
+         cw->transparent.user_r = r;
+         cw->transparent.user_g = g;
+         cw->transparent.user_b = b;
+         cw->transparent.user_a = a;
+
+         ELOGF("COMP", "Transparent enabled user_color(%d,%d,%d,%d)",
+               cw->ec,
+               cw->transparent.user_r,
+               cw->transparent.user_g,
+               cw->transparent.user_b,
+               cw->transparent.user_a);
+
+         cw->transparent.set = EINA_TRUE;
+      }
+    else
+      {
+         cw->transparent.set = EINA_FALSE;
+
+         evas_object_color_set(obj,
+                               cw->transparent.user_r,
+                               cw->transparent.user_g,
+                               cw->transparent.user_b,
+                               cw->transparent.user_a);
+
+         ELOGF("COMP", "Transparent disabled user_color(%d,%d,%d,%d)",
+               cw->ec,
+               cw->transparent.user_r,
+               cw->transparent.user_g,
+               cw->transparent.user_b,
+               cw->transparent.user_a);
+      }
+
+   return EINA_TRUE;
+}
+
 /* helper function to simplify toggling of redirection for display servers which support it */
 E_API void
 e_comp_object_redirected_set(Evas_Object *obj, Eina_Bool set)
@@ -4774,11 +4858,14 @@ e_comp_object_redirected_set(Evas_Object *obj, Eina_Bool set)
           e_comp_object_render_update_add(obj);
         else
           e_comp_object_damage(obj, 0, 0, cw->w, cw->h);
+
+        _e_comp_object_transparent_set(obj, EINA_FALSE);
         evas_object_smart_callback_call(obj, "redirected", NULL);
      }
    else
      {
         _e_comp_object_clear(cw);
+        _e_comp_object_transparent_set(obj, EINA_TRUE);
         evas_object_smart_callback_call(obj, "unredirected", NULL);
      }
 }
@@ -6666,5 +6753,15 @@ e_comp_object_color_get(Evas_Object *obj, int *r, int *g, int *b, int *a)
 {
    API_ENTRY;
 
-   evas_object_color_get(obj, r, g, b, a);
+   if (cw->transparent.set)
+     {
+        if (r) *r = cw->transparent.user_r;
+        if (g) *g = cw->transparent.user_g;
+        if (b) *b = cw->transparent.user_b;
+        if (a) *a = cw->transparent.user_a;
+     }
+   else
+     {
+        evas_object_color_get(obj, r, g, b, a);
+     }
 }