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
This commit is contained in:
Carlos Garnacho 2020-02-07 01:02:47 +01:00
parent 56dc99a9fb
commit e67f0bfcfd

View File

@ -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: