From d0fffdab1628c17220425f90d5f341f462739bb1 Mon Sep 17 00:00:00 2001 From: Foxe Chen Date: Sun, 31 May 2026 18:24:21 +0000 Subject: [PATCH] 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 Signed-off-by: Christian Brabandt --- src/gui_gtk4.c | 11 +++++------ src/version.c | 2 ++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gui_gtk4.c b/src/gui_gtk4.c index b5e134b8a4..1596f19e5c 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 cc7fdadc15..15a4d34e9c 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, /**/