Merge branch 'wip/carlosg/x11-wm-drags' into 'master'

gtkmain: Disable implicit grab active state on CROSSING_GRAB leave events

Closes #4416

See merge request GNOME/gtk!4162
This commit is contained in:
Matthias Clasen 2021-11-16 17:21:38 +00:00
commit d9d220cfc9

View File

@ -1345,14 +1345,26 @@ handle_pointing_event (GdkEvent *event)
switch ((guint) type) switch ((guint) type)
{ {
case GDK_LEAVE_NOTIFY: case GDK_LEAVE_NOTIFY:
if (gdk_crossing_event_get_mode (event) == GDK_CROSSING_GRAB)
{
GtkWidget *grab_widget;
grab_widget =
gtk_window_lookup_pointer_focus_implicit_grab (toplevel,
device,
sequence);
if (grab_widget)
set_widget_active_state (grab_widget, FALSE);
}
old_target = update_pointer_focus_state (toplevel, event, NULL);
gtk_synthesize_crossing_events (GTK_ROOT (toplevel), GTK_CROSSING_POINTER, old_target, NULL,
event, gdk_crossing_event_get_mode (event), NULL);
break;
case GDK_TOUCH_END: case GDK_TOUCH_END:
case GDK_TOUCH_CANCEL: case GDK_TOUCH_CANCEL:
old_target = update_pointer_focus_state (toplevel, event, NULL); old_target = update_pointer_focus_state (toplevel, event, NULL);
if (type == GDK_TOUCH_END || type == GDK_TOUCH_CANCEL) set_widget_active_state (old_target, FALSE);
set_widget_active_state (old_target, FALSE);
else if (type == GDK_LEAVE_NOTIFY)
gtk_synthesize_crossing_events (GTK_ROOT (toplevel), GTK_CROSSING_POINTER, old_target, NULL,
event, gdk_crossing_event_get_mode (event), NULL);
break; break;
case GDK_DRAG_LEAVE: case GDK_DRAG_LEAVE:
{ {