[gtk: 5/15] gtkeventcontrollerscroll: Refactor scroll begin
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 5/15] gtkeventcontrollerscroll: Refactor scroll begin
- Date: Wed, 26 Jan 2022 23:37:29 +0000 (UTC)
commit 5cd289dc1d908e79106e20eaa4a85749f2286606
Author: José Expósito <jose exposito89 gmail com>
Date: Fri Jun 18 17:55:47 2021 +0200
gtkeventcontrollerscroll: Refactor scroll begin
Move the logic to begin scrolling to its own function to be able to
reuse it.
Refactor, no functional changes.
Part-of: <!3454>
gtk/gtkeventcontrollerscroll.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkeventcontrollerscroll.c b/gtk/gtkeventcontrollerscroll.c
index b246bb22db..cfe284cd71 100644
--- a/gtk/gtkeventcontrollerscroll.c
+++ b/gtk/gtkeventcontrollerscroll.c
@@ -235,6 +235,21 @@ gtk_event_controller_scroll_get_property (GObject *object,
}
}
+static gboolean
+gtk_event_controller_scroll_begin (GtkEventController *controller)
+{
+ GtkEventControllerScroll *scroll = GTK_EVENT_CONTROLLER_SCROLL (controller);
+
+ if (scroll->active)
+ return FALSE;
+
+ g_signal_emit (controller, signals[SCROLL_BEGIN], 0);
+ scroll_history_reset (scroll);
+ scroll->active = TRUE;
+
+ return TRUE;
+}
+
static gboolean
gtk_event_controller_scroll_handle_event (GtkEventController *controller,
GdkEvent *event,
@@ -258,13 +273,7 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
if (direction == GDK_SCROLL_SMOOTH)
{
gdk_scroll_event_get_deltas (event, &dx, &dy);
-
- if (!scroll->active)
- {
- g_signal_emit (controller, signals[SCROLL_BEGIN], 0);
- scroll_history_reset (scroll);
- scroll->active = TRUE;
- }
+ gtk_event_controller_scroll_begin (controller);
if ((scroll->flags & GTK_EVENT_CONTROLLER_SCROLL_VERTICAL) == 0)
dy = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]