gdk/wayland: Pass surface-relative coordinates in DnD events

Make this event behave like the other regular events, and emit
coordinates based on native surfaces. Fixes DnD over popovers
finding the correct coordinates.
This commit is contained in:
Carlos Garnacho 2023-11-24 23:35:45 +01:00
parent 0c19ef6c2c
commit 988b9de210

View File

@ -345,7 +345,6 @@ data_device_enter (void *data,
GdkWaylandSeat *seat = data;
GdkSurface *dest_surface;
GdkContentFormats *formats;
int origin_x, origin_y;
GdkDevice *device;
dest_surface = wl_surface_get_user_data (surface);
@ -392,12 +391,10 @@ data_device_enter (void *data,
gdk_wayland_seat_discard_pending_offer (seat);
gdk_surface_get_origin (gdk_drop_get_surface (seat->drop), &origin_x, &origin_y);
gdk_drop_emit_enter_event (seat->drop,
FALSE,
origin_x + seat->pointer_info.surface_x,
origin_y + seat->pointer_info.surface_y,
seat->pointer_info.surface_x,
seat->pointer_info.surface_y,
GDK_CURRENT_TIME);
}
@ -431,7 +428,6 @@ data_device_motion (void *data,
wl_fixed_t y)
{
GdkWaylandSeat *seat = data;
int origin_x, origin_y;
GDK_SEAT_DEBUG (seat, EVENTS,
"data device motion, data_device = %p, time = %d, x = %f, y = %f",
@ -444,12 +440,10 @@ data_device_motion (void *data,
seat->pointer_info.surface_x = wl_fixed_to_double (x);
seat->pointer_info.surface_y = wl_fixed_to_double (y);
gdk_surface_get_origin (gdk_drop_get_surface (seat->drop), &origin_x, &origin_y);
gdk_drop_emit_motion_event (seat->drop,
FALSE,
origin_x + seat->pointer_info.surface_x,
origin_y + seat->pointer_info.surface_y,
seat->pointer_info.surface_x,
seat->pointer_info.surface_y,
time);
}
@ -458,17 +452,14 @@ data_device_drop (void *data,
struct wl_data_device *data_device)
{
GdkWaylandSeat *seat = data;
int origin_x, origin_y;
GDK_SEAT_DEBUG (seat, EVENTS,
"data device drop, data device %p", data_device);
gdk_surface_get_origin (gdk_drop_get_surface (seat->drop), &origin_x, &origin_y);
gdk_drop_emit_drop_event (seat->drop,
FALSE,
origin_x + seat->pointer_info.surface_x,
origin_y + seat->pointer_info.surface_y,
seat->pointer_info.surface_x,
seat->pointer_info.surface_y,
GDK_CURRENT_TIME);
}