gtk/main: Toggle active flag with touch events

This went missing at some point, add the missing toggling of active
state with GDK_TOUCH_BEGIN/END/CANCEL events.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3348
This commit is contained in:
Carlos Garnacho 2020-11-12 17:31:52 +01:00
parent 92ca3a3419
commit 50a7e59623

View File

@ -1413,7 +1413,9 @@ handle_pointing_event (GdkEvent *event)
case GDK_TOUCH_END:
case GDK_TOUCH_CANCEL:
old_target = update_pointer_focus_state (toplevel, event, NULL);
if (type == GDK_LEAVE_NOTIFY)
if (type == GDK_TOUCH_END || type == GDK_TOUCH_CANCEL)
set_widget_active_state (old_target, TRUE);
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;
@ -1465,7 +1467,10 @@ handle_pointing_event (GdkEvent *event)
gtk_drop_end_event (drop);
}
else if (type == GDK_TOUCH_BEGIN)
{
gtk_window_set_pointer_focus_grab (toplevel, device, sequence, target);
set_widget_active_state (target, FALSE);
}
/* Let it take the effective pointer focus anyway, as it may change due
* to implicit grabs.