[gtk/wip/exalm/kinetic_scrolling] eventcontrollerscroll: Fix the history push condition
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/exalm/kinetic_scrolling] eventcontrollerscroll: Fix the history push condition
- Date: Thu, 14 May 2020 20:34:29 +0000 (UTC)
commit 5dc6194b98792d937c648835cfadbe64977db443
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Fri May 15 01:20:38 2020 +0500
eventcontrollerscroll: Fix the history push condition
Once upon a time, there was a function called gdk_event_get_scroll_deltas().
It returned %TRUE when an event had scroll deltas and that was used as the
condition to decide whether to push scroll deltas to the scroll history,
even when the both deltas are 0 for the stop event at the end of scrolling.
When GtkScrolledWindow kinetic scrolling code was adapted for
GtkEventControllerScroll, it was replaced with a (dx != 0 && dy != 0)
check. This prevented the stop event from getting into the history, and
instead allowed non-smooth scrolling to affect the history as they have
synthetic deltas with one of the values being -1 or 1 and the other on 0.
Instead, check the direction as we already have it as a local variable.
gtk/gtkeventcontrollerscroll.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkeventcontrollerscroll.c b/gtk/gtkeventcontrollerscroll.c
index f10ba6085d..2cee4be4b8 100644
--- a/gtk/gtkeventcontrollerscroll.c
+++ b/gtk/gtkeventcontrollerscroll.c
@@ -329,12 +329,11 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
}
if (dx != 0 || dy != 0)
- {
- g_signal_emit (controller, signals[SCROLL], 0, dx, dy, &handled);
+ g_signal_emit (controller, signals[SCROLL], 0, dx, dy, &handled);
- if (scroll->flags & GTK_EVENT_CONTROLLER_SCROLL_KINETIC)
- scroll_history_push (scroll, dx, dy, gdk_event_get_time (event));
- }
+ if (direction == GDK_SCROLL_SMOOTH &&
+ scroll->flags & GTK_EVENT_CONTROLLER_SCROLL_KINETIC)
+ scroll_history_push (scroll, dx, dy, gdk_event_get_time (event));
if (scroll->active && gdk_scroll_event_is_stop (event))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]