gdk/wayland: Keep track of implicit grabs

Tracking of those broke sometime along the gdk cleanups, so we
started missing some GDK_GRAB_BROKEN events from being emitted
(eg. after a button press/implicit grab triggers an active grab).

Implicit grabs are only added if there's no prior grab (either
implicit through other button presses, or explicit), in order to
keep accounting correct, make those prevail.
This commit is contained in:
Carlos Garnacho 2020-05-12 10:19:47 +02:00
parent 5e765eaac4
commit 2bd8124b5d

View File

@ -2293,7 +2293,27 @@ _gdk_windowing_got_event (GdkDisplay *display,
else if (type == GDK_LEAVE_NOTIFY)
_gdk_display_set_surface_under_pointer (display, device, NULL);
if (type == GDK_BUTTON_RELEASE ||
if (type == GDK_BUTTON_PRESS)
{
GdkSurface *grab_surface;
gboolean owner_events;
if (!gdk_device_grab_info (display, device, &grab_surface, &owner_events))
{
_gdk_display_add_device_grab (display,
device,
event_surface,
GDK_OWNERSHIP_NONE,
FALSE,
GDK_ALL_EVENTS_MASK,
serial,
gdk_event_get_time (event),
TRUE);
_gdk_display_device_grab_update (display, device,
source_device, serial);
}
}
else if (type == GDK_BUTTON_RELEASE ||
type == GDK_TOUCH_CANCEL ||
type == GDK_TOUCH_END)
{