From: Carlos Garnacho Date: Fri, 7 Feb 2020 00:02:47 +0000 (+0100) Subject: gtkmain: Wait for GDK_CROSSING_UNGRAB leave event with implicit grabs X-Git-Tag: archive/raspbian/4.4.1+ds1-2+rpi1^2~18^2~20^2~83^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e67f0bfcfda56950c82a5f384e2d4c640ab7a7f4;p=gtk4.git gtkmain: Wait for GDK_CROSSING_UNGRAB leave event with implicit grabs If there is a passive grab and the pointer leaves the window we would receive a GDK_CROSSING_NORMAL event when the pointer moves outside the window, and a GDK_CROSSING_UNGRAB event when we do release the button and the implicit grab. We currently would react to the first, but want to react to the second. In the time between both events, the client would still receive pointer motion that will reach the implicitly grabbed widget. Closes: https://gitlab.gnome.org/GNOME/gtk/issues/13 --- diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 887ce9bd14..d8c1d35beb 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -1742,9 +1742,14 @@ handle_pointing_event (GdkEvent *event) switch ((guint) event->any.type) { case GDK_LEAVE_NOTIFY: - if (event->crossing.mode == GDK_CROSSING_GRAB || - event->crossing.mode == GDK_CROSSING_UNGRAB) - break; + if (event->crossing.mode == GDK_CROSSING_NORMAL && + gtk_window_lookup_pointer_focus_implicit_grab (toplevel, device, NULL)) + { + /* We have an implicit grab, wait for the corresponding + * GDK_CROSSING_UNGRAB. + */ + break; + } G_GNUC_FALLTHROUGH; case GDK_TOUCH_END: case GDK_TOUCH_CANCEL: