From 23d5dcd0807a586544637ac2dc26b4b840b95797 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 30 Oct 2024 19:12:21 +0100 Subject: [PATCH] Fix touch event propagation (custom grab) See also 79dae5f2b4a75211935527ef3ebcdcedf9c423be --- libs/tk/ydk/gdkwindow.c | 4 ++++ libs/tk/ytk/gtkmain.c | 14 +++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/libs/tk/ydk/gdkwindow.c b/libs/tk/ydk/gdkwindow.c index 054d628814..8755b52905 100644 --- a/libs/tk/ydk/gdkwindow.c +++ b/libs/tk/ydk/gdkwindow.c @@ -10861,6 +10861,10 @@ proxy_button_event (GdkEvent *source_event, else if (type == GDK_TOUCH_END && display->touch_grabs) { GdkEventTouch* tev = (GdkEventTouch*) source_event; + void* w = g_hash_table_lookup (display->touch_grabs, GUINT_TO_POINTER (tev->sequence)); + if (w) { + event_win = GDK_WINDOW (w); + } g_hash_table_remove (display->touch_grabs, GUINT_TO_POINTER (tev->sequence)); } else if (type == GDK_TOUCH_UPDATE && display->touch_grabs) diff --git a/libs/tk/ytk/gtkmain.c b/libs/tk/ytk/gtkmain.c index 4cb2516a2f..c152ad3755 100644 --- a/libs/tk/ytk/gtkmain.c +++ b/libs/tk/ytk/gtkmain.c @@ -1427,6 +1427,11 @@ rewrite_event_for_grabs (GdkEvent *event) return NULL; break; + case GDK_TOUCH_BEGIN: + case GDK_TOUCH_END: + case GDK_TOUCH_UPDATE: + return NULL; + default: return NULL; } @@ -1599,7 +1604,6 @@ gtk_main_do_event (GdkEvent *event) case GDK_BUTTON_PRESS: case GDK_2BUTTON_PRESS: case GDK_3BUTTON_PRESS: - case GDK_TOUCH_BEGIN: gtk_propagate_event (grab_widget, event); break; @@ -1637,12 +1641,16 @@ gtk_main_do_event (GdkEvent *event) /* else fall through */ case GDK_MOTION_NOTIFY: case GDK_BUTTON_RELEASE: - case GDK_TOUCH_UPDATE: - case GDK_TOUCH_END: case GDK_PROXIMITY_IN: case GDK_PROXIMITY_OUT: gtk_propagate_event (grab_widget, event); break; + + case GDK_TOUCH_BEGIN: + case GDK_TOUCH_UPDATE: + case GDK_TOUCH_END: + gtk_propagate_event (event_widget, event); + break; case GDK_ENTER_NOTIFY: GTK_PRIVATE_SET_FLAG (event_widget, GTK_HAS_POINTER);