[gtk/wip/carlosg/scroll-speed-4-6] gtkscrolledwindow: Backport scroll speed from 4.7/main




commit 9e598ff7cd90b2e380a97527af2404df36d2354e
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Aug 11 23:52:44 2022 +0200

    gtkscrolledwindow: Backport scroll speed from 4.7/main
    
    Only the scroll velocity factor is backported here, the scroll unit
    event API is notably missing, so this implicitly applies to all smooth
    scroll events.
    
    The number also accounts for the 1/10th factor applied in GDK, compared
    to the code in main.

 gtk/gtkscrolledwindow.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 77c5832e02..1887382416 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -1261,6 +1261,17 @@ get_scroll_unit (GtkScrolledWindow        *sw,
   }
 #endif
 
+#ifdef GDK_WINDOWING_WAYLAND
+  {
+    GdkEvent *event = gtk_event_controller_get_current_event (GTK_EVENT_CONTROLLER (scroll));
+
+    if (event != NULL &&
+        gdk_event_get_event_type (event) == GDK_SCROLL &&
+        gdk_scroll_event_get_direction (event) == GDK_SCROLL_SMOOTH)
+      scroll_unit = 25;
+  }
+#endif
+
   return scroll_unit;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]