e_comp_wl: fix not sending a mouse enter event. 15/37715/2
authorBoram Park <boram1288.park@samsung.com>
Thu, 2 Apr 2015 04:00:49 +0000 (13:00 +0900)
committerBoram Park <boram1288.park@samsung.com>
Fri, 3 Apr 2015 05:05:13 +0000 (14:05 +0900)
Change-Id: I21cb031e293fe281e35ba89f3a96116a28a48856

src/bin/e_comp_wl.c
src/bin/e_comp_wl_data.c
src/bin/e_comp_wl_input.c
src/modules/wl_desktop_shell/e_mod_main.c

index 937693181a2ab536b9ffbb5239509c3254b8a9bd..a43fd01b3b70e956dc5d73424bf629fa7dfdd300 100644 (file)
@@ -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));
      }
 }
 
index 024b178ded5bedba2faa29a8e55de6ffc8194d93..52047cff00116c8a0980c984dbc0f4b1dd3e5f43 100644 (file)
@@ -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);
      }
 }
index 74fc2dc99e4294df573b33eb760e2e60cc5b7c97..c19e2e1692e3c53a3158ab20939187ca1b1b1a7c 100644 (file)
@@ -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 
index 9ced6fd785731c06a300bec0fb8f93874d53469a..d925dc3e45f59c1715bf4d10de77818d3b59c169 100644 (file)
@@ -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);