e_comp_wl: add intercept hooks for cursor timer when mouse wheel/down/up 65/292865/1
authorduna.oh <duna.oh@samsung.com>
Wed, 10 May 2023 05:11:02 +0000 (14:11 +0900)
committerduna.oh <duna.oh@samsung.com>
Tue, 16 May 2023 05:48:34 +0000 (14:48 +0900)
Change-Id: I00467aa607b43a5f8e463e5e44394b26d7e8eb79

src/bin/e_comp_wl.c
src/bin/e_comp_wl.h

index edc4d574b87f9a896c1851bb371cb932cfa5e8d6..96e825cad7b903a18ccaccc2e60a2a81877e1d52 100644 (file)
@@ -38,6 +38,7 @@ EINTERN int E_EVENT_WAYLAND_GLOBAL_ADD = -1;
 static void _e_comp_wl_move_resize_init(void);
 
 static E_Client * _e_comp_wl_client_usable_get(pid_t pid, E_Pixmap *ep);
+static Eina_Bool _e_comp_wl_cursor_timer_control(Evas_Callback_Type type, E_Client *ec);
 
 /* local variables */
 typedef struct _E_Comp_Wl_Transform_Context
@@ -100,6 +101,9 @@ static Eina_Inlist *_e_comp_wl_intercept_hooks[] =
    [E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_IN] = NULL,
    [E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_OUT] = NULL,
    [E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_MOVE] = NULL,
+   [E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_WHEEL] = NULL,
+   [E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_DOWN] = NULL,
+   [E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_UP] = NULL,
 };
 
 static Eina_List *hooks = NULL;
@@ -1082,6 +1086,33 @@ _e_comp_wl_cursor_timer_control(Evas_Callback_Type type, E_Client *ec)
             _e_comp_wl_cursor_reload(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 (e_pointer_is_hidden(e_comp->pointer))
+            _e_comp_wl_cursor_reload(ec);
+          break;
+
+        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 (e_comp_wl->ptr.hide_tmr)
+            {
+               ecore_timer_del(e_comp_wl->ptr.hide_tmr);
+               e_comp_wl->ptr.hide_tmr = NULL;
+            }
+          cursor_timer_ec = NULL;
+
+          if (e_pointer_is_hidden(e_comp->pointer))
+            _e_comp_wl_cursor_reload(ec);
+          break;
+
+        case EVAS_CALLBACK_MOUSE_UP:
+          ret = _e_comp_wl_intercept_hook_call(E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_UP, ec);
+          if (!ret) break;
+
         default:
           break;
      }
@@ -1430,15 +1461,8 @@ _e_comp_wl_evas_cb_mouse_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *o
      {
         if (e_config->use_cursor_timer)
           {
-             if (e_comp_wl->ptr.hide_tmr)
-               {
-                  ecore_timer_del(e_comp_wl->ptr.hide_tmr);
-                  e_comp_wl->ptr.hide_tmr = NULL;
-               }
-             cursor_timer_ec = NULL;
-
-             if (e_pointer_is_hidden(e_comp->pointer))
-               _e_comp_wl_cursor_reload(ec);
+             if (!_e_comp_wl_cursor_timer_control(EVAS_CALLBACK_MOUSE_DOWN, ec))
+               return;
           }
 
         e_comp_wl_evas_handle_mouse_button(ec, ev->timestamp, ev->button,
@@ -1510,6 +1534,12 @@ _e_comp_wl_evas_cb_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *even
      }
    else
      {
+        if (e_config->use_cursor_timer)
+          {
+             if (!_e_comp_wl_cursor_timer_control(EVAS_CALLBACK_MOUSE_UP, ec))
+               return;
+          }
+
         e_comp_wl_evas_handle_mouse_button(ec, ev->timestamp, ev->button,
                                            WL_POINTER_BUTTON_STATE_RELEASED);
 
@@ -1571,8 +1601,8 @@ _e_comp_wl_evas_cb_mouse_wheel(void *data, Evas *evas EINA_UNUSED, Evas_Object *
 
    if (e_config->use_cursor_timer)
       {
-         if (e_pointer_is_hidden(e_comp->pointer))
-           _e_comp_wl_cursor_reload(ec);
+         if (!_e_comp_wl_cursor_timer_control(EVAS_CALLBACK_MOUSE_WHEEL, ec))
+           return;
       }
 
    _e_comp_wl_device_send_event_device(ec, ev->dev, ev->timestamp);
@@ -5720,8 +5750,8 @@ e_comp_wl_mouse_wheel_send(E_Client *ec, int direction, int z, Ecore_Device *dev
 
    if (e_config->use_cursor_timer)
       {
-         if (e_pointer_is_hidden(e_comp->pointer))
-           _e_comp_wl_cursor_reload(ec);
+         if (!_e_comp_wl_cursor_timer_control(EVAS_CALLBACK_MOUSE_WHEEL, ec))
+           return EINA_TRUE;
       }
 
    if (dev) _e_comp_wl_send_event_device(wc, time, dev, serial);
index 7ff67b5b694cfee44796c60461df71eab71da657..f3541aae5194e875eb6741a8d823da0dfc95e5f5 100644 (file)
@@ -89,6 +89,9 @@ typedef enum _E_Comp_Wl_Intercept_Hook_Point
    E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_IN,
    E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_OUT,
    E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_MOVE,
+   E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_WHEEL,
+   E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_DOWN,
+   E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_UP,
    E_COMP_WL_INTERCEPT_HOOK_LAST,
 } E_Comp_Wl_Intercept_Hook_Point;