From 50a7e59623683c77c6be54977eda30f8917bb8b5 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Thu, 12 Nov 2020 17:31:52 +0100 Subject: [PATCH] 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 --- gtk/gtkmain.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index cfc74ce43e..96ff1e69ad 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -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); + { + 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.