patch 9.1.0086: Problem when scrolling using slow touchpads scroll event

Commit: 
https://github.com/vim/vim/commit/725c7c31a4c7603e688511d769b0addaab442d07
Author: lilydjwg <[email protected]>
Date:   Fri Feb 9 19:24:23 2024 +0100

    patch 9.1.0086: Problem when scrolling using slow touchpads scroll event
    
    Problem:  Problem when scrolling using slow touchpads scroll event
    Solution: better ways to determine if a smooth scroll has ended (when
              available) (lilydjwg)
    
    related: #13997
    
    Signed-off-by: lilydjwg <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index a89a77429..518edaf04 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -2049,7 +2049,7 @@ button_press_event(GtkWidget *widget,
 }
 
 /*
- * GTK+ 2 abstracts scrolling via the GdkEventScroll.
+ * GTK+ abstracts scrolling via the GdkEventScroll.
  */
     static gboolean
 scroll_event(GtkWidget *widget,
@@ -2060,7 +2060,9 @@ scroll_event(GtkWidget *widget,
     int_u   vim_modifiers;
 #if GTK_CHECK_VERSION(3,4,0)
     static double  acc_x, acc_y;
+#if !GTK_CHECK_VERSION(3,22,0)
     static guint32 last_smooth_event_time;
+#endif
 #define DT_X11     1
 #define DT_WAYLAND 2
     static display_type;
@@ -2087,12 +2089,25 @@ scroll_event(GtkWidget *widget,
            break;
 #if GTK_CHECK_VERSION(3,4,0)
        case GDK_SCROLL_SMOOTH:
+           if (event->is_stop)
+           {
+               acc_x = acc_y = 0;
+               // this event tells us to stop, without an actual moving
+               return FALSE;
+           }
+#if GTK_CHECK_VERSION(3,22,0)
+           if (gdk_device_get_axes(event->device) & GDK_AXIS_FLAG_WHEEL)
+               // this is from a wheel (as oppose to a touchpad / trackpoint)
+#else
            if (event->time - last_smooth_event_time > 50)
                // reset our accumulations after 50ms of silence
+#endif
                acc_x = acc_y = 0;
            acc_x += event->delta_x;
            acc_y += event->delta_y;
+#if !GTK_CHECK_VERSION(3,22,0)
            last_smooth_event_time = event->time;
+#endif
            break;
 #endif
        default: // This shouldn't happen
diff --git a/src/version.c b/src/version.c
index 33325a664..8002c95b6 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    86,
 /**/
     85,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1rYVdU-005YJw-8y%40256bit.org.

Raspunde prin e-mail lui