mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 14:10:30 +00:00
Merge branch 'wip/dnd-fixes' into 'main'
DnD fixes See merge request GNOME/gtk!6608
This commit is contained in:
commit
c99f62aef1
@ -395,7 +395,7 @@ _gdk_wayland_surface_drag_begin (GdkSurface *surface,
|
||||
drag_wayland->data_source,
|
||||
gdk_wayland_surface_get_wl_surface (surface),
|
||||
gdk_wayland_surface_get_wl_surface (drag_wayland->dnd_surface),
|
||||
_gdk_wayland_seat_get_implicit_grab_serial (seat, NULL));
|
||||
_gdk_wayland_seat_get_implicit_grab_serial (seat, device, NULL));
|
||||
|
||||
cursor = gdk_drag_get_cursor (drag, gdk_drag_get_selected_action (drag));
|
||||
gdk_drag_set_cursor (drag, cursor);
|
||||
|
@ -164,8 +164,9 @@ void _gdk_wayland_display_remove_seat (GdkWaylandDisplay *displa
|
||||
guint32 id);
|
||||
|
||||
GdkKeymap *_gdk_wayland_device_get_keymap (GdkDevice *device);
|
||||
uint32_t _gdk_wayland_seat_get_implicit_grab_serial(GdkSeat *seat,
|
||||
GdkEvent *event);
|
||||
uint32_t _gdk_wayland_seat_get_implicit_grab_serial (GdkSeat *seat,
|
||||
GdkDevice *event,
|
||||
GdkEventSequence *sequence);
|
||||
uint32_t _gdk_wayland_seat_get_last_implicit_grab_serial (GdkWaylandSeat *seat,
|
||||
GdkEventSequence **sequence);
|
||||
GdkSurface * gdk_wayland_device_get_focus (GdkDevice *device);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
@ -4330,35 +4321,39 @@ _gdk_wayland_display_remove_seat (GdkWaylandDisplay *display_wayland,
|
||||
}
|
||||
|
||||
uint32_t
|
||||
_gdk_wayland_seat_get_implicit_grab_serial (GdkSeat *seat,
|
||||
GdkEvent *event)
|
||||
_gdk_wayland_seat_get_implicit_grab_serial (GdkSeat *seat,
|
||||
GdkDevice *device,
|
||||
GdkEventSequence *sequence)
|
||||
{
|
||||
GdkEventSequence *sequence = NULL;
|
||||
GdkWaylandTouchData *touch = NULL;
|
||||
|
||||
if (event)
|
||||
sequence = gdk_event_get_event_sequence (event);
|
||||
GdkWaylandSeat *wayland_seat = GDK_WAYLAND_SEAT (seat);
|
||||
GList *l;
|
||||
|
||||
if (sequence)
|
||||
touch = gdk_wayland_seat_get_touch (GDK_WAYLAND_SEAT (seat),
|
||||
GDK_EVENT_SEQUENCE_TO_SLOT (sequence));
|
||||
|
||||
if (touch)
|
||||
return touch->touch_down_serial;
|
||||
|
||||
if (event)
|
||||
{
|
||||
GdkDevice *source = gdk_event_get_device (event);
|
||||
GdkWaylandSeat *wayland_seat = GDK_WAYLAND_SEAT (seat);
|
||||
GList *l;
|
||||
GdkWaylandTouchData *touch = NULL;
|
||||
|
||||
for (l = wayland_seat->tablets; l; l = l->next)
|
||||
{
|
||||
GdkWaylandTabletData *tablet = l->data;
|
||||
touch = gdk_wayland_seat_get_touch (GDK_WAYLAND_SEAT (seat),
|
||||
GDK_EVENT_SEQUENCE_TO_SLOT (sequence));
|
||||
if (touch)
|
||||
return touch->touch_down_serial;
|
||||
}
|
||||
else if (device == wayland_seat->logical_touch)
|
||||
{
|
||||
GdkWaylandTouchData *touch;
|
||||
GHashTableIter iter;
|
||||
|
||||
if (tablet->stylus_device == source)
|
||||
return tablet->pointer_info.press_serial;
|
||||
}
|
||||
/* Pick the first sequence */
|
||||
g_hash_table_iter_init (&iter, wayland_seat->touches);
|
||||
g_hash_table_iter_next (&iter, NULL, (gpointer *) &touch);
|
||||
return touch->touch_down_serial;
|
||||
}
|
||||
|
||||
for (l = wayland_seat->tablets; l; l = l->next)
|
||||
{
|
||||
GdkWaylandTabletData *tablet = l->data;
|
||||
|
||||
if (tablet->logical_device == device)
|
||||
return tablet->pointer_info.press_serial;
|
||||
}
|
||||
|
||||
return GDK_WAYLAND_SEAT (seat)->pointer_info.press_serial;
|
||||
|
@ -1904,7 +1904,9 @@ gdk_wayland_toplevel_show_window_menu (GdkToplevel *toplevel,
|
||||
wl_seat = gdk_wayland_seat_get_wl_seat (seat);
|
||||
gdk_event_get_position (event, &x, &y);
|
||||
|
||||
serial = _gdk_wayland_seat_get_implicit_grab_serial (seat, event);
|
||||
serial = _gdk_wayland_seat_get_implicit_grab_serial (seat,
|
||||
gdk_event_get_device (event),
|
||||
gdk_event_get_event_sequence (event));
|
||||
|
||||
switch (display_wayland->shell_variant)
|
||||
{
|
||||
|
@ -1696,7 +1696,7 @@ gtk_main_do_event (GdkEvent *event)
|
||||
{
|
||||
GdkDrop *drop = gdk_dnd_event_get_drop (event);
|
||||
gtk_drop_begin_event (drop, gdk_event_get_event_type (event));
|
||||
gtk_propagate_event (target_widget, event);
|
||||
gtk_propagate_event (grab_widget, event);
|
||||
gtk_drop_end_event (drop);
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user