e_comp_wl: replace evas event with ecore event in cursor timer control 32/322232/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Fri, 4 Apr 2025 04:10:11 +0000 (13:10 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Mon, 7 Apr 2025 02:21:29 +0000 (11:21 +0900)
Change-Id: I92943b57269c5ed0d29bad70a330f7279242d3c6
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/bin/server/e_comp_wl.c

index 021823b3ae6ca82f4c7814d2f8fdf6df537950be..6fcad7da0f91a59ae93531d4783a9d2431f053f5 100644 (file)
@@ -89,7 +89,7 @@ struct _E_Comp_Data
    struct wl_listener client_created;
 };
 
-static Eina_Bool _e_comp_wl_cursor_timer_control(Evas_Callback_Type type, E_Comp_Wl_Data *comp_wl, E_Client *ec);
+static Eina_Bool _e_comp_wl_cursor_timer_control(int type, E_Comp_Wl_Data *comp_wl, E_Client *ec);
 
 /* local variables */
 typedef struct _E_Comp_Wl_Key_Data
@@ -1178,75 +1178,70 @@ _e_comp_wl_device_handle_axes(const char *dev_name, Evas_Device_Class dev_class,
 }
 
 static Eina_Bool
-_e_comp_wl_cursor_timer_control(Evas_Callback_Type type, E_Comp_Wl_Data *comp_wl, E_Client *ec)
+_e_comp_wl_cursor_timer_control(int type, E_Comp_Wl_Data *comp_wl, E_Client *ec)
 {
    E_Pointer *comp_pointer = e_comp_pointer_get();
 
    Eina_Bool ret = EINA_TRUE;
-   switch (type)
-     {
-        case EVAS_CALLBACK_MOUSE_IN:
-          ret = _e_comp_wl_intercept_hook_call(E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_IN, ec);
-          if (!ret) break;
-
-          if (comp_wl->ptr.hide_tmr)
-            {
-               ecore_timer_del(comp_wl->ptr.hide_tmr);
-               cursor_timer_ec = ec;
-               comp_wl->ptr.hide_tmr = ecore_timer_add(e_config->cursor_timer_interval, _e_comp_wl_cursor_timer, ec);
-            }
-          else
-            {
-               if (e_pointer_is_hidden(comp_pointer))
-                 ret = EINA_FALSE;
-            }
-          break;
-
-        case EVAS_CALLBACK_MOUSE_OUT:
-          ret = _e_comp_wl_intercept_hook_call(E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_OUT, ec);
-          if (!ret) break;
-
-          if (!comp_wl->ptr.hide_tmr && e_pointer_is_hidden(comp_pointer))
-            ret = EINA_FALSE;
-          break;
-
-        case EVAS_CALLBACK_MOUSE_MOVE:
-          ret = _e_comp_wl_intercept_hook_call(E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_MOVE, ec);
-          if (!ret) break;
-
-          if (e_pointer_is_hidden(comp_pointer) || !ec->pointer_enter_sent)
-            _e_comp_wl_cursor_reload(comp_wl, ec);
-          break;
-
-        case EVAS_CALLBACK_MOUSE_WHEEL:
-          ret = _e_comp_wl_intercept_hook_call(E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_WHEEL, ec);
-          if (!ret) break;
+   if (type == ECORE_EVENT_MOUSE_IN)
+     {
+        ret = _e_comp_wl_intercept_hook_call(E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_IN, ec);
+        if (!ret) return ret;
 
-          if (e_pointer_is_hidden(comp_pointer) || !ec->pointer_enter_sent)
-            _e_comp_wl_cursor_reload(comp_wl, ec);
-          break;
+        if (comp_wl->ptr.hide_tmr)
+          {
+             ecore_timer_del(comp_wl->ptr.hide_tmr);
+             cursor_timer_ec = ec;
+             comp_wl->ptr.hide_tmr = ecore_timer_add(e_config->cursor_timer_interval, _e_comp_wl_cursor_timer, ec);
+          }
+        else
+          {
+             if (e_pointer_is_hidden(comp_pointer))
+               ret = EINA_FALSE;
+          }
+     }
+   else if (type == ECORE_EVENT_MOUSE_OUT)
+     {
+        ret = _e_comp_wl_intercept_hook_call(E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_OUT, ec);
+        if (!ret) return ret;
 
-        case EVAS_CALLBACK_MOUSE_DOWN:
-          ret = _e_comp_wl_intercept_hook_call(E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_DOWN, ec);
-          if (!ret) break;
+        if (!comp_wl->ptr.hide_tmr && e_pointer_is_hidden(comp_pointer))
+          ret = EINA_FALSE;
+     }
+   else if (type == ECORE_EVENT_MOUSE_MOVE)
+     {
+        ret = _e_comp_wl_intercept_hook_call(E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_MOVE, ec);
+        if (!ret) return ret;
 
-          if (comp_wl->ptr.hide_tmr)
-            {
-               ecore_timer_del(comp_wl->ptr.hide_tmr);
-               comp_wl->ptr.hide_tmr = NULL;
-            }
-          cursor_timer_ec = NULL;
+        if (e_pointer_is_hidden(comp_pointer) || !ec->pointer_enter_sent)
+          _e_comp_wl_cursor_reload(comp_wl, ec);
+     }
+   else if (type == ECORE_EVENT_MOUSE_WHEEL)
+     {
+        ret = _e_comp_wl_intercept_hook_call(E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_WHEEL, ec);
+        if (!ret) return ret;
 
-          if (e_pointer_is_hidden(comp_pointer) || !ec->pointer_enter_sent)
-            _e_comp_wl_cursor_reload(comp_wl, ec);
-          break;
+        if (e_pointer_is_hidden(comp_pointer) || !ec->pointer_enter_sent)
+          _e_comp_wl_cursor_reload(comp_wl, ec);
+     }
+   else if (type == ECORE_EVENT_MOUSE_BUTTON_DOWN)
+     {
+        ret = _e_comp_wl_intercept_hook_call(E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_DOWN, ec);
+        if (!ret) return ret;
 
-        case EVAS_CALLBACK_MOUSE_UP:
-          ret = _e_comp_wl_intercept_hook_call(E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_UP, ec);
-          break;
+        if (comp_wl->ptr.hide_tmr)
+          {
+             ecore_timer_del(comp_wl->ptr.hide_tmr);
+             comp_wl->ptr.hide_tmr = NULL;
+          }
+        cursor_timer_ec = NULL;
 
-        default:
-          break;
+        if (e_pointer_is_hidden(comp_pointer) || !ec->pointer_enter_sent)
+          _e_comp_wl_cursor_reload(comp_wl, ec);
+     }
+   else if (type == ECORE_EVENT_MOUSE_BUTTON_UP)
+     {
+        ret = _e_comp_wl_intercept_hook_call(E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_UP, ec);
      }
 
    return ret;
@@ -1327,7 +1322,7 @@ _e_comp_wl_evas_cb_mouse_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj
 
    if (_e_comp_wl_check_cursor_timer_needed(ec))
      {
-        if (!_e_comp_wl_cursor_timer_control(EVAS_CALLBACK_MOUSE_IN, comp_wl, ec))
+        if (!_e_comp_wl_cursor_timer_control(ECORE_EVENT_MOUSE_IN, comp_wl, ec))
           return;
      }
 
@@ -1374,7 +1369,7 @@ _e_comp_wl_evas_cb_mouse_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *ob
 
    if (_e_comp_wl_check_cursor_timer_needed(ec))
      {
-        if (!_e_comp_wl_cursor_timer_control(EVAS_CALLBACK_MOUSE_OUT, comp_wl, ec))
+        if (!_e_comp_wl_cursor_timer_control(ECORE_EVENT_MOUSE_OUT, comp_wl, ec))
           return;
      }
 
@@ -1565,7 +1560,7 @@ _e_comp_wl_evas_cb_mouse_move(void *data, Evas *evas EINA_UNUSED, Evas_Object *o
           {
              if (_e_comp_wl_check_cursor_timer_needed(ec))
                {
-                  if (!_e_comp_wl_cursor_timer_control(EVAS_CALLBACK_MOUSE_MOVE, comp_wl, ec))
+                  if (!_e_comp_wl_cursor_timer_control(ECORE_EVENT_MOUSE_MOVE, comp_wl, ec))
                     return;
                }
 
@@ -1665,7 +1660,7 @@ _e_comp_wl_evas_cb_mouse_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *o
      {
         if (_e_comp_wl_check_cursor_timer_needed(ec))
           {
-             if (!_e_comp_wl_cursor_timer_control(EVAS_CALLBACK_MOUSE_DOWN, comp_wl, ec))
+             if (!_e_comp_wl_cursor_timer_control(ECORE_EVENT_MOUSE_BUTTON_DOWN, comp_wl, ec))
                return;
           }
 
@@ -1737,7 +1732,7 @@ _e_comp_wl_evas_cb_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *even
      {
         if (_e_comp_wl_check_cursor_timer_needed(ec))
           {
-             if (!_e_comp_wl_cursor_timer_control(EVAS_CALLBACK_MOUSE_UP, comp_wl, ec))
+             if (!_e_comp_wl_cursor_timer_control(ECORE_EVENT_MOUSE_BUTTON_UP, comp_wl, ec))
                return;
           }
 
@@ -1804,7 +1799,7 @@ _e_comp_wl_evas_cb_mouse_wheel(void *data, Evas *evas EINA_UNUSED, Evas_Object *
 
    if (_e_comp_wl_check_cursor_timer_needed(ec))
      {
-        if (!_e_comp_wl_cursor_timer_control(EVAS_CALLBACK_MOUSE_WHEEL, comp_wl, ec))
+        if (!_e_comp_wl_cursor_timer_control(ECORE_EVENT_MOUSE_WHEEL, comp_wl, ec))
           return;
      }
 
@@ -2538,7 +2533,7 @@ _e_comp_wl_cb_mouse_move(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mou
           {
              if (_e_comp_wl_check_cursor_timer_needed(ec))
                {
-                  if (!_e_comp_wl_cursor_timer_control(EVAS_CALLBACK_MOUSE_MOVE, comp_wl, ec))
+                  if (!_e_comp_wl_cursor_timer_control(ECORE_EVENT_MOUSE_MOVE, comp_wl, ec))
                     goto end;
                }
 
@@ -2591,7 +2586,7 @@ _e_comp_wl_cb_mouse_wheel(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mo
 
    if (_e_comp_wl_check_cursor_timer_needed(ec))
      {
-        if (!_e_comp_wl_cursor_timer_control(EVAS_CALLBACK_MOUSE_WHEEL, comp_wl, ec))
+        if (!_e_comp_wl_cursor_timer_control(ECORE_EVENT_MOUSE_WHEEL, comp_wl, ec))
           goto end;
      }
 
@@ -2701,7 +2696,7 @@ _e_comp_wl_zone_send_mouse_button(Ecore_Event_Mouse_Button *ev, Eina_Bool presse
      {
         if (_e_comp_wl_check_cursor_timer_needed(ec))
           {
-             if (!_e_comp_wl_cursor_timer_control(pressed ? EVAS_CALLBACK_MOUSE_DOWN : EVAS_CALLBACK_MOUSE_UP, comp_wl, ec))
+             if (!_e_comp_wl_cursor_timer_control(pressed ? ECORE_EVENT_MOUSE_BUTTON_DOWN : ECORE_EVENT_MOUSE_BUTTON_UP, comp_wl, ec))
                return;
           }
 
@@ -5218,7 +5213,7 @@ e_comp_wl_mouse_wheel_send(E_Client *ec, int direction, int z, Ecore_Device *dev
 
    if (_e_comp_wl_check_cursor_timer_needed(ec))
       {
-         if (!_e_comp_wl_cursor_timer_control(EVAS_CALLBACK_MOUSE_WHEEL, comp_wl, ec))
+         if (!_e_comp_wl_cursor_timer_control(ECORE_EVENT_MOUSE_WHEEL, comp_wl, ec))
            return EINA_TRUE;
       }