From 04453c120f04661d25f89b15108d275fe0592814 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Thu, 2 Apr 2015 13:00:49 +0900 Subject: [PATCH] e_comp_wl: fix not sending a mouse enter event. Change-Id: I21cb031e293fe281e35ba89f3a96116a28a48856 --- src/bin/e_comp_wl.c | 14 ++++++-------- src/bin/e_comp_wl_data.c | 13 ++++++++++++- src/bin/e_comp_wl_input.c | 15 +++++++++++++++ src/modules/wl_desktop_shell/e_mod_main.c | 32 +++++++++++++++++++------------ 4 files changed, 53 insertions(+), 21 deletions(-) diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index 9376931..a43fd01 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -222,16 +222,14 @@ _e_comp_wl_evas_cb_mouse_move(void *data, Evas *evas EINA_UNUSED, Evas_Object *o Eina_List *l; ev = event; + + e_comp->wl_comp_data->ptr.x = wl_fixed_from_int(ev->cur.canvas.x); + e_comp->wl_comp_data->ptr.y = wl_fixed_from_int(ev->cur.canvas.y); + if (!(ec = data)) return; if (ec->cur_mouse_action) return; if (e_object_is_del(E_OBJECT(ec))) return; if (e_client_util_ignored_get(ec)) return; - - ec->comp->wl_comp_data->ptr.x = - wl_fixed_from_int(ev->cur.canvas.x - ec->client.x); - ec->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); @@ -240,8 +238,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, - ec->comp->wl_comp_data->ptr.x, - ec->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)); } } diff --git a/src/bin/e_comp_wl_data.c b/src/bin/e_comp_wl_data.c index 024b178..52047cf 100644 --- a/src/bin/e_comp_wl_data.c +++ b/src/bin/e_comp_wl_data.c @@ -689,6 +689,8 @@ e_comp_wl_data_device_keyboard_focus_set(E_Comp_Data *cdata) { struct wl_resource *data_device_res, *offer_res, *focus; E_Comp_Wl_Data_Source *source; + E_Pixmap *ep; + E_Client *ec; if (!cdata->kbd.enabled) { @@ -702,6 +704,10 @@ e_comp_wl_data_device_keyboard_focus_set(E_Comp_Data *cdata) return; } + if (!(ep = wl_resource_get_user_data(focus))) return; + if (!(ec = e_pixmap_client_get(ep))) return; + if (e_object_is_del(E_OBJECT(ec))) return; + data_device_res = _e_comp_wl_data_find_for_client(cdata->mgr.data_resources, wl_resource_get_client(focus)); @@ -711,13 +717,18 @@ e_comp_wl_data_device_keyboard_focus_set(E_Comp_Data *cdata) if (source) { uint32_t serial; + int cx, cy; serial = wl_display_next_serial(cdata->wl.disp); offer_res = _e_comp_wl_data_device_data_offer_create(source, data_device_res); + + cx = wl_fixed_to_int(cdata->ptr.x) - ec->client.x; + cy = wl_fixed_to_int(cdata->ptr.y) - ec->client.y; + wl_data_device_send_enter(data_device_res, serial, focus, - cdata->ptr.x, cdata->ptr.y, offer_res); + wl_fixed_from_int(cx), wl_fixed_from_int(cy), offer_res); wl_data_device_send_selection(data_device_res, offer_res); } } diff --git a/src/bin/e_comp_wl_input.c b/src/bin/e_comp_wl_input.c index 74fc2dc..c19e2e1 100644 --- a/src/bin/e_comp_wl_input.c +++ b/src/bin/e_comp_wl_input.c @@ -108,6 +108,9 @@ _e_comp_wl_input_cb_pointer_get(struct wl_client *client, struct wl_resource *re { E_Comp_Data *cdata; struct wl_resource *res; + E_Client *ec; + uint32_t serial; + int cx, cy; /* get compositor data */ if (!(cdata = wl_resource_get_user_data(resource))) return; @@ -125,6 +128,18 @@ _e_comp_wl_input_cb_pointer_get(struct wl_client *client, struct wl_resource *re cdata->ptr.resources = eina_list_append(cdata->ptr.resources, res); wl_resource_set_implementation(res, &_e_pointer_interface, cdata, _e_comp_wl_input_cb_pointer_unbind); + + if (!(ec = e_client_focused_get())) return; + if (e_object_is_del(E_OBJECT(ec))) return; + if (!ec->comp_data->surface) return; + if (client != wl_resource_get_client(ec->comp_data->surface)) return; + + cx = wl_fixed_to_int(e_comp->wl_comp_data->ptr.x) - ec->client.x; + cy = wl_fixed_to_int(e_comp->wl_comp_data->ptr.y) - ec->client.y; + + serial = wl_display_next_serial(e_comp->wl_comp_data->wl.disp); + wl_pointer_send_enter(res, serial, ec->comp_data->surface, + wl_fixed_from_int(cx), wl_fixed_from_int(cy)); } static void diff --git a/src/modules/wl_desktop_shell/e_mod_main.c b/src/modules/wl_desktop_shell/e_mod_main.c index 9ced6fd..d925dc3 100644 --- a/src/modules/wl_desktop_shell/e_mod_main.c +++ b/src/modules/wl_desktop_shell/e_mod_main.c @@ -188,8 +188,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); @@ -201,6 +201,7 @@ _e_shell_surface_cb_resize(struct wl_client *client EINA_UNUSED, struct wl_resou E_Client *ec; E_Comp_Data *cdata; E_Binding_Event_Mouse_Button ev; + int cx, cy; /* get the client for this resource */ if (!(ec = wl_resource_get_user_data(resource))) @@ -229,8 +230,11 @@ _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; + + cx = wl_fixed_to_int(cdata->ptr.x) - ec->client.x; + cy = wl_fixed_to_int(cdata->ptr.y) - ec->client.y; + cdata->ptr.grab_x = wl_fixed_from_int(cx); + cdata->ptr.grab_y = wl_fixed_from_int(cy); switch (cdata->ptr.button) { @@ -249,8 +253,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); @@ -794,8 +798,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); @@ -807,6 +811,7 @@ _e_xdg_shell_surface_cb_resize(struct wl_client *client EINA_UNUSED, struct wl_r E_Client *ec; E_Comp_Data *cdata; E_Binding_Event_Mouse_Button ev; + int cx, cy; /* DBG("XDG_SHELL: Surface Resize: %d\tEdges: %d", */ /* wl_resource_get_id(resource), edges); */ @@ -836,8 +841,11 @@ _e_xdg_shell_surface_cb_resize(struct wl_client *client EINA_UNUSED, struct wl_r cdata->resize.resource = resource; cdata->resize.edges = edges; - cdata->ptr.grab_x = cdata->ptr.x; - cdata->ptr.grab_y = cdata->ptr.y; + + cx = wl_fixed_to_int(cdata->ptr.x) - ec->client.x; + cy = wl_fixed_to_int(cdata->ptr.y) - ec->client.y; + cdata->ptr.grab_x = wl_fixed_from_int(cx); + cdata->ptr.grab_y = wl_fixed_from_int(cy); switch (cdata->ptr.button) { @@ -856,8 +864,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); -- 2.7.4