[gtk/wip/exalm/scroll-hold] eventcontrollerscroll: Always propagate hold events
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/exalm/scroll-hold] eventcontrollerscroll: Always propagate hold events
- Date: Mon, 28 Mar 2022 09:28:14 +0000 (UTC)
commit 29e2ce3bbe31e0a483887b7d80270c432fd8a1bc
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Mon Mar 28 01:05:23 2022 +0400
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]