e_comp_object: make signals provided by e_comp_object 52/299852/2
authorSooChan Lim <sc1.lim@samsung.com>
Wed, 4 Oct 2023 05:55:29 +0000 (14:55 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Wed, 11 Oct 2023 06:12:55 +0000 (06:12 +0000)
These are used instead of e_comp_object's hooks

Change-Id: Ib942340ef00658e331b539b2e7c1f27187132f24

src/bin/e_comp_object.c
src/bin/e_comp_object_intern.h [new file with mode: 0644]

index 95c6e2f..23bd2c3 100644 (file)
@@ -184,6 +184,13 @@ typedef struct _E_Comp_Object
         int              user_b;
         int              user_a;
      } transparent;
+
+   struct
+     {
+        struct wl_signal lower;
+        struct wl_signal show;
+        struct wl_signal hide;
+     } events;
 } E_Comp_Object;
 
 typedef struct _E_Input_Rect_Data
@@ -1984,7 +1991,7 @@ _e_comp_object_raise(Evas_Object *obj)
 }
 
 static void
-_e_comp_object_lower(Evas_Object *obj)
+_e_comp_object_lower(E_Comp_Object *cw, Evas_Object *obj)
 {
    evas_object_lower(obj);
 
@@ -1995,7 +2002,7 @@ _e_comp_object_lower(Evas_Object *obj)
 #ifdef REFACTOR_FOCUS_POLICY
           {
              _e_comp_object_hook_call(E_COMP_OBJECT_HOOK_RESTACK, ec);
-             _e_comp_object_hook_call(E_COMP_OBJECT_HOOK_LOWER, ec);
+             wl_signal_emit_mutable(&cw->events.lower, NULL);
           }
 #else
           _e_comp_object_hook_call(E_COMP_OBJECT_HOOK_RESTACK, ec);
@@ -2258,7 +2265,7 @@ _e_comp_intercept_lower(void *data, Evas_Object *obj)
         if (cw->ec->layer_pending)
           e_comp_object_layer_update(obj, NULL, obj);
 
-        _e_comp_object_lower(obj);
+        _e_comp_object_lower(cw, obj);
         goto end;
      }
    if (!EINA_INLIST_GET(cw->ec)->prev) goto end; //already lowest on layer
@@ -2269,7 +2276,7 @@ _e_comp_intercept_lower(void *data, Evas_Object *obj)
    if (evas_object_layer_get(o) != evas_object_layer_get(obj)) goto end; //already at bottom!
    if (obj == e_comp->layers[cw->layer].obj) goto end; //never lower a layer marker!
    evas_object_data_set(obj, "client_restack", (void*)1);
-   _e_comp_object_lower(obj);
+   _e_comp_object_lower(cw, obj);
    evas_object_data_del(obj, "client_restack");
    if (!cw->visible) goto end;
    e_comp_render_queue();
@@ -2368,7 +2375,7 @@ _e_comp_intercept_hide(void *data, Evas_Object *obj)
         ELOGF("COMP", "Hide hidden evas_object:%p", cw->ec, obj);
         evas_object_hide(obj);
 #ifdef REFACTOR_FOCUS_POLICY
-        _e_comp_object_hook_call(E_COMP_OBJECT_HOOK_HIDE, cw->ec);
+        wl_signal_emit_mutable(&cw->events.hide, NULL);
 #endif
         return;
      }
@@ -2379,7 +2386,7 @@ _e_comp_intercept_hide(void *data, Evas_Object *obj)
         ELOGF("COMP", "Hide input_only evas_object:%p", cw->ec, obj);
         evas_object_hide(obj);
 #ifdef REFACTOR_FOCUS_POLICY
-        _e_comp_object_hook_call(E_COMP_OBJECT_HOOK_HIDE, cw->ec);
+        wl_signal_emit_mutable(&cw->events.hide, NULL);
 #endif
         return;
      }
@@ -2423,7 +2430,7 @@ _e_comp_intercept_hide(void *data, Evas_Object *obj)
    ELOGF("COMP", "Hide normal object:%p", cw->ec, obj);
    evas_object_hide(obj);
 #ifdef REFACTOR_FOCUS_POLICY
-   _e_comp_object_hook_call(E_COMP_OBJECT_HOOK_HIDE, cw->ec);
+   wl_signal_emit_mutable(&cw->events.hide, NULL);
 #endif
 }
 
@@ -2608,6 +2615,7 @@ _e_comp_intercept_show_helper(E_Comp_Object *cw)
 
 #ifdef REFACTOR_FOCUS_POLICY
    _e_comp_object_hook_call(E_COMP_OBJECT_HOOK_SHOW, cw->ec);
+   wl_signal_emit_mutable(&cw->events.show, NULL);
 #endif
 }
 
@@ -3200,6 +3208,10 @@ _e_comp_smart_add(Evas_Object *obj)
    cw = E_NEW(E_Comp_Object, 1);
    EINA_SAFETY_ON_NULL_RETURN(cw);
 
+   wl_signal_init(&cw->events.lower);
+   wl_signal_init(&cw->events.show);
+   wl_signal_init(&cw->events.hide);
+
    cw->smart_obj = obj;
    cw->x = cw->y = cw->w = cw->h = -1;
    evas_object_smart_data_set(obj, cw);
@@ -6681,3 +6693,45 @@ e_comp_object_render_op_get(Evas_Object *obj)
 
    return evas_object_render_op_get(cw->obj);
 }
+
+EINTERN void
+e_comp_object_lower_listener_add(Evas_Object *obj, struct wl_listener *listener)
+{
+   API_ENTRY;
+   wl_signal_add(&cw->events.lower, listener);
+}
+
+EINTERN struct wl_listener *
+e_comp_object_lower_listener_get(Evas_Object *obj, wl_notify_func_t notify)
+{
+   API_ENTRY NULL;
+   return wl_signal_get(&cw->events.lower, notify);
+}
+
+EINTERN void
+e_comp_object_show_listener_add(Evas_Object *obj, struct wl_listener *listener)
+{
+   API_ENTRY;
+   wl_signal_add(&cw->events.show, listener);
+}
+
+EINTERN struct wl_listener *
+e_comp_object_show_listener_get(Evas_Object *obj, wl_notify_func_t notify)
+{
+   API_ENTRY NULL;
+   return wl_signal_get(&cw->events.show, notify);
+}
+
+EINTERN void
+e_comp_object_hide_listener_add(Evas_Object *obj, struct wl_listener *listener)
+{
+   API_ENTRY;
+   wl_signal_add(&cw->events.hide, listener);
+}
+
+EINTERN struct wl_listener *
+e_comp_object_hide_listener_get(Evas_Object *obj, wl_notify_func_t notify)
+{
+   API_ENTRY NULL;
+   return wl_signal_get(&cw->events.hide, notify);
+}
diff --git a/src/bin/e_comp_object_intern.h b/src/bin/e_comp_object_intern.h
new file mode 100644 (file)
index 0000000..6bf8002
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef E_COMP_OBJECT_INTERN_H
+#define E_COMP_OBJECT_INTERN_H
+
+#include <wayland-server.h>
+
+EINTERN void                 e_comp_object_lower_listener_add(Evas_Object *obj, struct wl_listener *listener);
+EINTERN struct wl_listener  *e_comp_object_lower_listener_get(Evas_Object *obj, wl_notify_func_t notify);
+
+EINTERN void                 e_comp_object_show_listener_add(Evas_Object *obj, struct wl_listener *listener);
+EINTERN struct wl_listener  *e_comp_object_show_listener_get(Evas_Object *obj, wl_notify_func_t notify);
+
+EINTERN void                 e_comp_object_hide_listener_add(Evas_Object *obj, struct wl_listener *listener);
+EINTERN struct wl_listener  *e_comp_object_hide_listener_get(Evas_Object *obj, wl_notify_func_t notify);
+
+#endif