From 33fdbc318955780e021122ee7ca66b1b295fadd5 Mon Sep 17 00:00:00 2001 From: "duna.oh" Date: Wed, 10 May 2023 14:11:02 +0900 Subject: [PATCH] e_comp_wl: add intercept hooks for cursor timer when mouse wheel/down/up Change-Id: I00467aa607b43a5f8e463e5e44394b26d7e8eb79 --- src/bin/e_comp_wl.c | 56 ++++++++++++++++++++++++++++++++++++++++------------- src/bin/e_comp_wl.h | 3 +++ 2 files changed, 46 insertions(+), 13 deletions(-) diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index 9b701d7..1304fb3 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -26,6 +26,7 @@ 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_Key_Data @@ -81,6 +82,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; @@ -1061,6 +1065,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; } @@ -1406,15 +1437,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, @@ -1486,6 +1510,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); @@ -1547,8 +1577,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); @@ -5590,8 +5620,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); diff --git a/src/bin/e_comp_wl.h b/src/bin/e_comp_wl.h index 2221120..281bf81 100644 --- a/src/bin/e_comp_wl.h +++ b/src/bin/e_comp_wl.h @@ -88,6 +88,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; -- 2.7.4