patch 9.2.0570: GTK4: mouse wheel scrolling does not work correctly

Commit: 
https://github.com/vim/vim/commit/d0fffdab1628c17220425f90d5f341f462739bb1
Author: Foxe Chen <[email protected]>
Date:   Sun May 31 18:24:21 2026 +0000

    patch 9.2.0570: GTK4: mouse wheel scrolling does not work correctly
    
    Problem:  GTK4: mouse wheel scrolling does not work correctly
    Solution: Use gui_mch_getmouse() to obtain the pointer position, and
              add GTK_EVENT_CONTROLLER_SCROLL_DISCRETE to the scroll
              controller flags (Foxe Chen).
    
    closes: #20389
    
    Signed-off-by: Foxe Chen <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/gui_gtk4.c b/src/gui_gtk4.c
index b5e134b8a..1596f19e5 100644
--- a/src/gui_gtk4.c
+++ b/src/gui_gtk4.c
@@ -573,7 +573,8 @@ gui_mch_init(void)
 
     {
        GtkEventController *scroll = gtk_event_controller_scroll_new(
-               GTK_EVENT_CONTROLLER_SCROLL_BOTH_AXES);
+               GTK_EVENT_CONTROLLER_SCROLL_BOTH_AXES
+               | GTK_EVENT_CONTROLLER_SCROLL_DISCRETE);
        g_signal_connect(scroll, "scroll",
                         G_CALLBACK(scroll_event), NULL);
        gtk_widget_add_controller(gui.drawarea, scroll);
@@ -1860,6 +1861,7 @@ scroll_event(GtkEventControllerScroll *controller UNUSED,
 {
     int button;
     int_u vim_modifiers;
+    int x, y;
     GdkModifierType state;
     GdkEvent *event;
 
@@ -1882,11 +1884,8 @@ scroll_event(GtkEventControllerScroll *controller UNUSED,
 
     vim_modifiers = modifiers_gdk2mouse(state);
 
-    {
-       double mx, my;
-       gdk_event_get_position(event, &mx, &my);
-       gui_send_mouse_event(button, (int)mx, (int)my, FALSE, vim_modifiers);
-    }
+    gui_mch_getmouse(&x, &y);
+    gui_send_mouse_event(button, x, y, FALSE, vim_modifiers);
 
     return TRUE;
 }
diff --git a/src/version.c b/src/version.c
index cc7fdadc1..15a4d34e9 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    570,
 /**/
     569,
 /**/

-- 
-- 
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 visit 
https://groups.google.com/d/msgid/vim_dev/E1wTkvD-00GONA-Jr%40256bit.org.

Raspunde prin e-mail lui