From 07401980bf8e14c46744c9357a9a41e9cb83b47f Mon Sep 17 00:00:00 2001 From: MinJeong Kim Date: Tue, 26 May 2015 23:32:47 +0900 Subject: [PATCH] Fix cursor problems - Remove size check for a cursor object. This size check always failed if it's first request for "set_cursor" with the cursor surface because ec->frame is never resized since it was created. - Update position values for cursor client. - Show/Hide cursor when pointer device is attached/detached by using handlers for ECORE_DRM_EVENT_INPUT_ADD/DEL. Change-Id: I64538317d09105e7a2c3b3257a86705a5e94873c Signed-off-by: MinJeong Kim --- src/bin/e_comp_object.c | 2 ++ src/bin/e_comp_wl.c | 2 +- src/bin/e_comp_wl_input.c | 4 --- src/modules/wl_drm/e_mod_main.c | 54 ++++++++++++++++++++++++++++++++--------- 4 files changed, 46 insertions(+), 16 deletions(-) diff --git a/src/bin/e_comp_object.c b/src/bin/e_comp_object.c index 15af875..f160cfc 100644 --- a/src/bin/e_comp_object.c +++ b/src/bin/e_comp_object.c @@ -819,6 +819,8 @@ _e_comp_intercept_move(void *data, Evas_Object *obj, int x, int y) if (!e_util_strcmp("wl_pointer-cursor", cw->ec->icccm.window_role)) { + cw->ec->client.x = x, cw->ec->client.y = y; + cw->ec->x = x, cw->ec->y = y; evas_object_move(obj, x, y); return; } diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index dd21e2b..6f880b3 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -398,7 +398,7 @@ _e_comp_wl_evas_cb_mouse_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *ob Evas_Object *o; ecore_evas_cursor_get(e_comp->ee, &o, NULL, NULL, NULL); - if (e_comp->pointer->o_ptr != o) + if ((e_comp->pointer->o_ptr != o) && (e_comp->wl_comp_data->ptr.enabled)) e_pointer_object_set(e_comp->pointer, NULL, 0, 0); } if (e_object_is_del(E_OBJECT(ec))) return; diff --git a/src/bin/e_comp_wl_input.c b/src/bin/e_comp_wl_input.c index d8c9c06..96dc6e8 100644 --- a/src/bin/e_comp_wl_input.c +++ b/src/bin/e_comp_wl_input.c @@ -35,7 +35,6 @@ _e_comp_wl_input_pointer_cb_cursor_set(struct wl_client *client, struct wl_resou E_Client *ec; uint64_t sid; Eina_Bool got_mouse = EINA_FALSE; - int cursor_w = 0, cursor_h = 0; /* get compositor data */ if (!(cdata = wl_resource_get_user_data(resource))) return; @@ -75,9 +74,6 @@ _e_comp_wl_input_pointer_cb_cursor_set(struct wl_client *client, struct wl_resou /* ignore cursor changes during resize/move I guess */ if (e_client_action_get()) return; - evas_object_geometry_get(ec->frame, NULL, NULL, &cursor_w, &cursor_h); - if ((cursor_w == 0) || (cursor_h == 0)) return; - e_pointer_object_set(e_comp->pointer, ec->frame, x, y); } diff --git a/src/modules/wl_drm/e_mod_main.c b/src/modules/wl_drm/e_mod_main.c index 692eb36..6e0949c 100644 --- a/src/modules/wl_drm/e_mod_main.c +++ b/src/modules/wl_drm/e_mod_main.c @@ -4,8 +4,7 @@ EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Drm" }; -static Ecore_Event_Handler *activate_handler; -static Ecore_Event_Handler *output_handler; +static Eina_List *event_handlers = NULL; static Eina_Bool session_state = EINA_FALSE; static Eina_Bool @@ -73,6 +72,39 @@ end: return ECORE_CALLBACK_PASS_ON; } +static Eina_Bool +_e_mod_drm_cb_input_device_add(void *data, int type, void *event) +{ + Ecore_Drm_Event_Input_Device_Add *e; + + if (!(e = event)) goto end; + + if (e->caps & EVDEV_SEAT_POINTER) + { + e_comp_wl_input_pointer_enabled_set(EINA_TRUE); + } + +end: + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_e_mod_drm_cb_input_device_del(void *data, int type, void *event) +{ + Ecore_Drm_Event_Input_Device_Del *e; + + if (!(e = event)) goto end; + + if (e->caps & EVDEV_SEAT_POINTER) + { + e_comp_wl_input_pointer_enabled_set(EINA_FALSE); + e_pointer_hide(e_comp->pointer); + } + +end: + return ECORE_CALLBACK_PASS_ON; +} + EAPI void * e_modapi_init(E_Module *m) { @@ -202,13 +234,14 @@ e_modapi_init(E_Module *m) * happens to jive with what drm does */ e_comp_wl_input_keymap_set(comp->wl_comp_data, NULL, NULL, NULL); - activate_handler = - ecore_event_handler_add(ECORE_DRM_EVENT_ACTIVATE, - _e_mod_drm_cb_activate, comp); - - output_handler = - ecore_event_handler_add(ECORE_DRM_EVENT_OUTPUT, - _e_mod_drm_cb_output, comp); + E_LIST_HANDLER_APPEND(event_handlers, ECORE_DRM_EVENT_ACTIVATE, + _e_mod_drm_cb_activate, comp); + E_LIST_HANDLER_APPEND(event_handlers, ECORE_DRM_EVENT_OUTPUT, + _e_mod_drm_cb_output, comp); + E_LIST_HANDLER_APPEND(event_handlers, ECORE_DRM_EVENT_INPUT_DEVICE_ADD, + _e_mod_drm_cb_input_device_add, comp); + E_LIST_HANDLER_APPEND(event_handlers, ECORE_DRM_EVENT_INPUT_DEVICE_DEL, + _e_mod_drm_cb_input_device_del, comp); return m; } @@ -219,8 +252,7 @@ e_modapi_shutdown(E_Module *m EINA_UNUSED) /* shutdown ecore_drm */ /* ecore_drm_shutdown(); */ - if (activate_handler) ecore_event_handler_del(activate_handler); - activate_handler = NULL; + E_FREE_LIST(event_handlers, ecore_event_handler_del); return 1; } -- 2.7.4