forked from AuroraMiddleware/gtk
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.
This commit is contained in:
parent
c025a569a9
commit
5dc6194b98
@ -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))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user