From d8197385cd7598dffc63ea2fa9dba4e820a111e0 Mon Sep 17 00:00:00 2001 From: Duna Oh Date: Mon, 17 Oct 2016 19:01:27 +0900 Subject: [PATCH] e_client: add e_client_cursor_hide() E_API for hiding client's cursor. Change-Id: Icdc93dcd741f95101e690f544002d691f6189d49 Signed-off-by: Duna Oh --- src/bin/e_client.c | 6 ++++++ src/bin/e_client.h | 2 ++ src/bin/e_comp_wl.c | 59 ++++++++++++++++++++++++++++++++--------------------- src/bin/e_comp_wl.h | 1 + 4 files changed, 45 insertions(+), 23 deletions(-) diff --git a/src/bin/e_client.c b/src/bin/e_client.c index 31b478e..280f231 100644 --- a/src/bin/e_client.c +++ b/src/bin/e_client.c @@ -6331,6 +6331,12 @@ e_client_normal_client_has(E_Client *ec) return e_comp_wl_normal_subsurface_has(ec); } +E_API Eina_Bool +e_client_cursor_hide(E_Client *ec) +{ + return e_comp_wl_cursor_hide(ec); +} + /* TODO: should be removed */ E_API void e_remember_del(void *rem) diff --git a/src/bin/e_client.h b/src/bin/e_client.h index 200b70a..5770f6b 100644 --- a/src/bin/e_client.h +++ b/src/bin/e_client.h @@ -1060,6 +1060,8 @@ E_API Eina_Bool e_client_mouse_wheel_send(E_Client *ec, int direction, int z, Ec E_API Eina_Bool e_client_video_client_has(E_Client *ec); E_API Eina_Bool e_client_normal_client_has(E_Client *ec); +E_API Eina_Bool e_client_cursor_hide(E_Client *ec); + E_API void e_remember_del(void *rem); /* TODO: should be removed */ /** diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index e38cf6b..f606c9d 100755 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -915,30 +915,8 @@ static Eina_Bool _e_comp_wl_cursor_timer(void *data) { E_Client *ec = data; - struct wl_resource *res; - struct wl_client *wc; - Eina_List *l; - uint32_t serial; - - e_pointer_object_set(e_comp->pointer, NULL, 0, 0); - - e_comp_wl->ptr.hide_tmr = NULL; - cursor_timer_ec = NULL; - if (!ec) return EINA_FALSE; - if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE; - - if (!ec->comp_data->surface) return EINA_FALSE; - wc = wl_resource_get_client(ec->comp_data->surface); - serial = wl_display_next_serial(e_comp_wl->wl.disp); - EINA_LIST_FOREACH(e_comp_wl->ptr.resources, l, res) - { - if (!e_comp_wl_input_pointer_check(res)) continue; - if (wl_resource_get_client(res) != wc) continue; - if (ec->pointer_enter_sent == EINA_FALSE) continue; - wl_pointer_send_leave(res, serial, ec->comp_data->surface); - ec->pointer_enter_sent = EINA_FALSE; - } + e_comp_wl_cursor_hide(ec); return ECORE_CALLBACK_CANCEL; } @@ -5799,3 +5777,38 @@ e_comp_wl_mouse_wheel_send(E_Client *ec, int direction, int z, Ecore_Device *dev return EINA_TRUE; } + +EINTERN Eina_Bool +e_comp_wl_cursor_hide(E_Client *ec) +{ + struct wl_resource *res; + struct wl_client *wc; + Eina_List *l; + uint32_t serial; + + e_pointer_object_set(e_comp->pointer, NULL, 0, 0); + + 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 (!ec) return EINA_FALSE; + if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE; + + if (!ec->comp_data->surface) return EINA_FALSE; + wc = wl_resource_get_client(ec->comp_data->surface); + serial = wl_display_next_serial(e_comp_wl->wl.disp); + EINA_LIST_FOREACH(e_comp_wl->ptr.resources, l, res) + { + if (!e_comp_wl_input_pointer_check(res)) continue; + if (wl_resource_get_client(res) != wc) continue; + if (ec->pointer_enter_sent == EINA_FALSE) continue; + wl_pointer_send_leave(res, serial, ec->comp_data->surface); + ec->pointer_enter_sent = EINA_FALSE; + } + + return EINA_TRUE; +} diff --git a/src/bin/e_comp_wl.h b/src/bin/e_comp_wl.h index d114611..ef20c25 100755 --- a/src/bin/e_comp_wl.h +++ b/src/bin/e_comp_wl.h @@ -550,6 +550,7 @@ EINTERN Eina_Bool e_comp_wl_touch_cancel_send(E_Client *ec); EINTERN Eina_Bool e_comp_wl_mouse_button_send(E_Client *ec, int buttons, Eina_Bool pressed, Ecore_Device *dev, uint32_t time); EINTERN Eina_Bool e_comp_wl_mouse_move_send(E_Client *ec, int x, int y, Ecore_Device *dev, uint32_t time); EINTERN Eina_Bool e_comp_wl_mouse_wheel_send(E_Client *ec, int direction, int z, Ecore_Device *dev, uint32_t time); +EINTERN Eina_Bool e_comp_wl_cursor_hide(E_Client *ec); E_API extern int E_EVENT_WAYLAND_GLOBAL_ADD; -- 2.7.4