gtk/eventscrollerscroll: Handle smooth events in discrete controllers

We let smooth scroll events that don't trigger a ::scroll signal through.
This is unintended, these are handled, even if just accumulated.

This fixes cases like GtkSpinButton inside GtkScrolledWindow, where both
would handle events, until the GtkSpinButton eventually shifts away from
underneath the pointer.

Brought up at https://gitlab.gnome.org/GNOME/gtk/-/issues/593
This commit is contained in:
Carlos Garnacho 2020-12-12 00:37:12 +01:00
parent 79090f1755
commit 8402665c55

View File

@ -325,6 +325,9 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
if (dx != 0 || dy != 0)
g_signal_emit (controller, signals[SCROLL], 0, dx, dy, &handled);
else if (direction == GDK_SCROLL_SMOOTH &&
(scroll->flags & GTK_EVENT_CONTROLLER_SCROLL_DISCRETE) != 0)
handled = scroll->active;
if (direction == GDK_SCROLL_SMOOTH &&
scroll->flags & GTK_EVENT_CONTROLLER_SCROLL_KINETIC)
@ -334,6 +337,7 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
{
g_signal_emit (controller, signals[SCROLL_END], 0);
scroll->active = FALSE;
handled = FALSE;
if (scroll->flags & GTK_EVENT_CONTROLLER_SCROLL_KINETIC)
{