e_comp_wl: fix transformed position that including position transform 42/300442/2
authorJunseok Kim <juns.kim@samsung.com>
Mon, 23 Oct 2023 11:22:58 +0000 (20:22 +0900)
committerJunSeok Kim <juns.kim@samsung.com>
Wed, 25 Oct 2023 05:41:00 +0000 (05:41 +0000)
Patch to fix gerrit commit id c18ca707dec2d6676cbe0f485b416901dabbcc4e

There was a bugs that past patch didn't consider the position transform and wl_data_device@enter event.
In particular, when changing the pointer's coordinates to transformed coordinates,
there was a problem that they did not match the client's local coordinate system.

For fix this bugs, consider the transformed position and adjust same logic when send wl_data_device_enter event.

Change-Id: I84eb4f4b0e8a1734e449dcc537b999c0e308d209

src/bin/e_comp_wl.c
src/bin/e_comp_wl_data.c

index 65e938753e64320ea64bc6ab88367b9cdc7edf3d..607875e9f5893f99d163a8a6bb40f432fcdcefbc 100644 (file)
@@ -2563,16 +2563,18 @@ _e_comp_wl_cb_mouse_move(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mou
         if (e_comp_wl->drag)
           e_drag_move(e_comp_wl->drag, ev->x, ev->y);
 
-        e_client_geometry_get(ec, &ec_x, &ec_y, NULL, NULL);
-        x = ev->x - ec_x;
-        y = ev->y - ec_y;
-
         if (e_client_transform_core_enable_get(ec))
           {
              int trans_x, trans_y;
-             e_client_transform_core_input_transform(ec, x, y, &trans_x, &trans_y);
-             x = trans_x;
-             y = trans_y;
+             e_client_transform_core_input_transform(ec, ev->x, ev->y, &trans_x, &trans_y);
+             x = trans_x - ec->client.x;
+             y = trans_y - ec->client.y;
+          }
+        else
+          {
+             e_client_geometry_get(ec, &ec_x, &ec_y, NULL, NULL);
+             x = ev->x - ec_x;
+             y = ev->y - ec_y;
           }
 
         wl_data_device_send_motion(res, ev->timestamp, wl_fixed_from_int(x), wl_fixed_from_int(y));
index c61f73dc3769f6fbd44ecd6505b63093f8ee873a..f2a2cff3302f2124c07bb800ac3c6e5fd392b83d 100644 (file)
@@ -1180,8 +1180,21 @@ e_comp_wl_data_device_send_enter(E_Client *ec)
    e_comp_wl->selection.target = ec;
    evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_DEL, _e_comp_wl_data_device_target_del, ec);
 
-   x = wl_fixed_to_int(e_comp_wl->ptr.x) - e_comp_wl->selection.target->client.x;
-   y = wl_fixed_to_int(e_comp_wl->ptr.y) - e_comp_wl->selection.target->client.y;
+   if (e_client_transform_core_enable_get(ec))
+     {
+        int trans_x, trans_y;
+        e_client_transform_core_input_transform(ec, wl_fixed_to_int(e_comp_wl->ptr.x), wl_fixed_to_int(e_comp_wl->ptr.y), &trans_x, &trans_y);
+        x = trans_x - ec->client.x;
+        y = trans_y - ec->client.y;
+     }
+   else
+     {
+        int ec_x, ec_y;
+        e_client_geometry_get(ec, &ec_x, &ec_y, NULL, NULL);
+        x = wl_fixed_to_int(e_comp_wl->ptr.x) - ec_x;
+        y = wl_fixed_to_int(e_comp_wl->ptr.y) - ec_y;
+     }
+
    serial = wl_display_next_serial(e_comp_wl->wl.disp);
    wl_data_device_send_enter(data_device_res, serial, surface,
                              wl_fixed_from_int(x), wl_fixed_from_int(y), offer_res);