From 9bd8ed0d82f3349b178be7999dc7f9439a6ccc1e Mon Sep 17 00:00:00 2001 From: Alexander Mikhaylenko Date: Mon, 28 Mar 2022 01:05:23 +0400 Subject: [PATCH] eventcontrollerscroll: Always propagate hold events Otherwise a stray scroll controller may prevent others from getting hold events, even if it always propagates scroll events and does absolutely nothing. --- gtk/gtkeventcontrollerscroll.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/gtk/gtkeventcontrollerscroll.c b/gtk/gtkeventcontrollerscroll.c index 500993bb8f..f40826cf7b 100644 --- a/gtk/gtkeventcontrollerscroll.c +++ b/gtk/gtkeventcontrollerscroll.c @@ -241,28 +241,26 @@ gtk_event_controller_scroll_get_property (GObject *object, } } -static gboolean +static void gtk_event_controller_scroll_begin (GtkEventController *controller) { GtkEventControllerScroll *scroll = GTK_EVENT_CONTROLLER_SCROLL (controller); if (scroll->active) - return FALSE; + return; g_signal_emit (controller, signals[SCROLL_BEGIN], 0); scroll_history_reset (scroll); scroll->active = TRUE; - - return TRUE; } -static gboolean +static void gtk_event_controller_scroll_end (GtkEventController *controller) { GtkEventControllerScroll *scroll = GTK_EVENT_CONTROLLER_SCROLL (controller); if (!scroll->active) - return FALSE; + return; g_signal_emit (controller, signals[SCROLL_END], 0); scroll->active = FALSE; @@ -274,8 +272,6 @@ gtk_event_controller_scroll_end (GtkEventController *controller) scroll_history_finish (scroll, &vel_x, &vel_y); g_signal_emit (controller, signals[DECELERATE], 0, vel_x, vel_y); } - - return TRUE; } static gboolean @@ -298,30 +294,29 @@ gtk_event_controller_scroll_handle_hold_event (GtkEventController *controller, GdkEvent *event) { GtkEventControllerScroll *scroll = GTK_EVENT_CONTROLLER_SCROLL (controller); - gboolean handled = GDK_EVENT_PROPAGATE; GdkTouchpadGesturePhase phase; guint n_fingers = 0; if (gdk_event_get_event_type (event) != GDK_TOUCHPAD_HOLD) - return handled; + return GDK_EVENT_PROPAGATE; n_fingers = gdk_touchpad_event_get_n_fingers (event); if (n_fingers != 1 && n_fingers != 2) - return handled; + return GDK_EVENT_PROPAGATE; if (scroll->hold_timeout_id != 0) - return handled; + return GDK_EVENT_PROPAGATE; phase = gdk_touchpad_event_get_gesture_phase (event); switch (phase) { case GDK_TOUCHPAD_GESTURE_PHASE_BEGIN: - handled = gtk_event_controller_scroll_begin (controller); + gtk_event_controller_scroll_begin (controller); break; case GDK_TOUCHPAD_GESTURE_PHASE_END: - handled = gtk_event_controller_scroll_end (controller); + gtk_event_controller_scroll_end (controller); break; case GDK_TOUCHPAD_GESTURE_PHASE_CANCEL: @@ -339,7 +334,7 @@ gtk_event_controller_scroll_handle_hold_event (GtkEventController *controller, break; } - return handled; + return GDK_EVENT_PROPAGATE; } static gboolean