From 5c46de06c61449787d9f5ed374385f9e35a97fa2 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Mon, 18 May 2015 11:53:05 -0400 Subject: [PATCH] e_comp_wl: fix not sending a mouse enter event to client. Summary: First of all, currently cdata->ptr.x,y contains e_client related pos. But, cdata is owned by e_comp, not per e_client. So cdata->ptr.x,y should contain absolute pos. And, when a pointer resource is created, enter event should be sent to client. Change-Id: I21cb031e293fe281e35ba89f3a96116a28a48856 Signed-off-by: Boram Park Test Plan: 1. run e as wayland server 2. move cursor to around 50,50 3. run elementary_test 4. click the mouse left button on slide toggle widget. (Don't move a cursor out of elementary_test. If you do, you can't find bug) Reviewers: gwanglim, raster, devilhorns, ManMower, zmike Reviewed By: zmike Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2330 --- src/bin/e_comp_wl.c | 29 +++++++++++++++-------- src/modules/wl_desktop_shell/e_mod_main.c | 24 +++++++++---------- 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index b4857fa5e..7879ef9d4 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -164,8 +164,8 @@ _e_comp_wl_evas_cb_mouse_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj if (!e_comp_wl_input_pointer_check(res)) continue; if (wl_resource_get_client(res) != wc) continue; wl_pointer_send_enter(res, serial, ec->comp_data->surface, - wl_fixed_from_int(ev->canvas.x), - wl_fixed_from_int(ev->canvas.y)); + wl_fixed_from_int(ev->canvas.x - ec->client.x), + wl_fixed_from_int(ev->canvas.y - ec->client.y)); } } @@ -218,12 +218,6 @@ _e_comp_wl_evas_cb_mouse_move(void *data, Evas *evas EINA_UNUSED, Evas_Object *o if (ec->cur_mouse_action) return; if (e_object_is_del(E_OBJECT(ec))) return; if (e_client_util_ignored_get(ec)) return; - - e_comp->wl_comp_data->ptr.x = - wl_fixed_from_int(ev->cur.canvas.x - ec->client.x); - e_comp->wl_comp_data->ptr.y = - wl_fixed_from_int(ev->cur.canvas.y - ec->client.y); - if (!ec->comp_data->surface) return; wc = wl_resource_get_client(ec->comp_data->surface); @@ -232,8 +226,8 @@ _e_comp_wl_evas_cb_mouse_move(void *data, Evas *evas EINA_UNUSED, Evas_Object *o if (!e_comp_wl_input_pointer_check(res)) continue; if (wl_resource_get_client(res) != wc) continue; wl_pointer_send_motion(res, ev->timestamp, - e_comp->wl_comp_data->ptr.x, - e_comp->wl_comp_data->ptr.y); + wl_fixed_from_int(ev->cur.canvas.x - ec->client.x), + wl_fixed_from_int(ev->cur.canvas.y - ec->client.y)); } } @@ -962,6 +956,19 @@ _e_comp_wl_cb_key_up(void *event) } } +static void +_e_comp_wl_cb_mouse_move(void *event) +{ + E_Comp_Data *cdata; + Ecore_Event_Mouse_Move *ev; + + if (!(cdata = e_comp->wl_comp_data)) return; + + ev = event; + cdata->ptr.x = wl_fixed_from_int(ev->x); + cdata->ptr.y = wl_fixed_from_int(ev->y); +} + static Eina_Bool _e_comp_wl_cb_input_event(void *data EINA_UNUSED, int type, void *ev) { @@ -971,6 +978,8 @@ _e_comp_wl_cb_input_event(void *data EINA_UNUSED, int type, void *ev) _e_comp_wl_cb_key_down(ev); else if (type == ECORE_EVENT_KEY_UP) _e_comp_wl_cb_key_up(ev); + else if (type == ECORE_EVENT_MOUSE_MOVE) + _e_comp_wl_cb_mouse_move(ev); return ECORE_CALLBACK_RENEW; } diff --git a/src/modules/wl_desktop_shell/e_mod_main.c b/src/modules/wl_desktop_shell/e_mod_main.c index 15f558bb3..63a77dde6 100644 --- a/src/modules/wl_desktop_shell/e_mod_main.c +++ b/src/modules/wl_desktop_shell/e_mod_main.c @@ -175,8 +175,8 @@ _e_shell_surface_cb_move(struct wl_client *client EINA_UNUSED, struct wl_resourc } e_comp_object_frame_xy_unadjust(ec->frame, - wl_fixed_to_int(cdata->ptr.x) + ec->client.x, - wl_fixed_to_int(cdata->ptr.y) + ec->client.y, + wl_fixed_to_int(cdata->ptr.x), + wl_fixed_to_int(cdata->ptr.y), &ev.canvas.x, &ev.canvas.y); _e_shell_surface_mouse_down_helper(ec, &ev, EINA_TRUE); @@ -209,8 +209,8 @@ _e_shell_surface_cb_resize(struct wl_client *client EINA_UNUSED, struct wl_resou cdata->resize.resource = resource; cdata->resize.edges = edges; - cdata->ptr.grab_x = cdata->ptr.x; - cdata->ptr.grab_y = cdata->ptr.y; + cdata->ptr.grab_x = cdata->ptr.x - wl_fixed_from_int(ec->client.x); + cdata->ptr.grab_y = cdata->ptr.y - wl_fixed_from_int(ec->client.y); switch (cdata->ptr.button) { @@ -229,8 +229,8 @@ _e_shell_surface_cb_resize(struct wl_client *client EINA_UNUSED, struct wl_resou } e_comp_object_frame_xy_unadjust(ec->frame, - wl_fixed_to_int(cdata->ptr.x) + ec->client.x, - wl_fixed_to_int(cdata->ptr.y) + ec->client.y, + wl_fixed_to_int(cdata->ptr.x), + wl_fixed_to_int(cdata->ptr.y), &ev.canvas.x, &ev.canvas.y); _e_shell_surface_mouse_down_helper(ec, &ev, EINA_FALSE); @@ -754,8 +754,8 @@ _e_xdg_shell_surface_cb_move(struct wl_client *client EINA_UNUSED, struct wl_res } e_comp_object_frame_xy_unadjust(ec->frame, - wl_fixed_to_int(cdata->ptr.x) + ec->client.x, - wl_fixed_to_int(cdata->ptr.y) + ec->client.y, + wl_fixed_to_int(cdata->ptr.x), + wl_fixed_to_int(cdata->ptr.y), &ev.canvas.x, &ev.canvas.y); _e_shell_surface_mouse_down_helper(ec, &ev, EINA_TRUE); @@ -788,8 +788,8 @@ _e_xdg_shell_surface_cb_resize(struct wl_client *client EINA_UNUSED, struct wl_r cdata = e_comp->wl_comp_data; cdata->resize.resource = resource; cdata->resize.edges = edges; - cdata->ptr.grab_x = cdata->ptr.x; - cdata->ptr.grab_y = cdata->ptr.y; + cdata->ptr.grab_x = cdata->ptr.x - wl_fixed_from_int(ec->client.x); + cdata->ptr.grab_y = cdata->ptr.y - wl_fixed_from_int(ec->client.y); switch (cdata->ptr.button) { @@ -808,8 +808,8 @@ _e_xdg_shell_surface_cb_resize(struct wl_client *client EINA_UNUSED, struct wl_r } e_comp_object_frame_xy_unadjust(ec->frame, - wl_fixed_to_int(cdata->ptr.x) + ec->client.x, - wl_fixed_to_int(cdata->ptr.y) + ec->client.y, + wl_fixed_to_int(cdata->ptr.x), + wl_fixed_to_int(cdata->ptr.y), &ev.canvas.x, &ev.canvas.y); _e_shell_surface_mouse_down_helper(ec, &ev, EINA_FALSE);