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

2 views
Skip to first unread message

Christian Brabandt

unread,
May 31, 2026, 2:30:15 PM (19 hours ago) May 31
to vim...@googlegroups.com
patch 9.2.0570: GTK4: mouse wheel scrolling does not work correctly

Commit: https://github.com/vim/vim/commit/d0fffdab1628c17220425f90d5f341f462739bb1
Author: Foxe Chen <chen...@gmail.com>
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 <chen...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

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,
/**/
Reply all
Reply to author
Forward
0 new messages