From 3fa5f09847a98a7594f24472f5bc2f406d472580 Mon Sep 17 00:00:00 2001 From: Robert Ancell Date: Fri, 25 Jun 2021 08:06:05 +1200 Subject: [PATCH] Re-enable non-smooth scrolling. (flutter/engine#26549) Since 0561c75b4d events are now handled in a GtkEventBox and the duplicate scroll events no longer occur. Fixes https://github.com/flutter/flutter/issues/73823 --- .../src/flutter/shell/platform/linux/fl_view.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/engine/src/flutter/shell/platform/linux/fl_view.cc b/engine/src/flutter/shell/platform/linux/fl_view.cc index 1c593ca730..d17a9ee6d6 100644 --- a/engine/src/flutter/shell/platform/linux/fl_view.cc +++ b/engine/src/flutter/shell/platform/linux/fl_view.cc @@ -485,14 +485,14 @@ static gboolean event_box_scroll_event(GtkWidget* widget, if (event->direction == GDK_SCROLL_SMOOTH) { scroll_delta_x = event->delta_x; scroll_delta_y = event->delta_y; - } else { - // We currently skip non-smooth scroll events due to the X11 events being - // delivered directly to the FlView X window and bypassing the GtkWindow - // handling. - // This causes both smooth and non-smooth events to be received (i.e. - // duplication). - // https://github.com/flutter/flutter/issues/73823 - return FALSE; + } else if (event->direction == GDK_SCROLL_UP) { + scroll_delta_y = -1; + } else if (event->direction == GDK_SCROLL_DOWN) { + scroll_delta_y = 1; + } else if (event->direction == GDK_SCROLL_LEFT) { + scroll_delta_x = -1; + } else if (event->direction == GDK_SCROLL_RIGHT) { + scroll_delta_x = 1; } // The multiplier is taken from the Chromium source