diff options
author | Alexander Mikhaylenko <alexm@gnome.org> | 2020-05-15 01:20:38 +0500 |
---|---|---|
committer | Alexander Mikhaylenko <alexm@gnome.org> | 2020-05-15 01:32:04 +0500 |
commit | 5dc6194b98792d937c648835cfadbe64977db443 (patch) | |
tree | 51ba8dd729ebbfb1c2c19c06a4f71729f71c20bc /gtk/gtkeventcontrollerscroll.c | |
parent | c025a569a9e94a721bb52d0595575040e1ca30bc (diff) | |
download | gtk+-5dc6194b98792d937c648835cfadbe64977db443.tar.gz |
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.
Diffstat (limited to 'gtk/gtkeventcontrollerscroll.c')
-rw-r--r-- | gtk/gtkeventcontrollerscroll.c | 9 |
1 files 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)) { |