From f7d2985f897b5e2353182bc5d9e6361d5cff5a32 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 12 May 2020 10:21:35 +0200 Subject: [PATCH] gdk/wayland: Ensure .leave events with active buttons breaks grabs Instead of silently ending up the grab, make it sure that we emit a GDK_GRAB_BROKEN event if needed. --- gdk/wayland/gdkdevice-wayland.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c index b30b1e63c7..4dde7a600a 100644 --- a/gdk/wayland/gdkdevice-wayland.c +++ b/gdk/wayland/gdkdevice-wayland.c @@ -706,7 +706,6 @@ device_maybe_emit_ungrab_crossing (GdkDevice *device, if (grab) { - grab->serial_end = grab->serial_start; prev_focus = grab->surface; surface = grab->surface; } @@ -1541,6 +1540,19 @@ pointer_handle_leave (void *data, _gdk_wayland_display_update_serial (display_wayland, serial); + if (seat->pointer_info.button_modifiers != 0) + { + gulong display_serial; + + display_serial = _gdk_display_get_next_serial (seat->display); + _gdk_display_end_device_grab (seat->display, seat->master_pointer, + display_serial, NULL, TRUE); + _gdk_display_device_grab_update (seat->display, + seat->master_pointer, + seat->pointer, + display_serial); + } + event = gdk_crossing_event_new (GDK_LEAVE_NOTIFY, seat->pointer_info.focus, seat->master_pointer,