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.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Foxe Chen
2026-05-31 18:24:21 +00:00
committed by Christian Brabandt
parent 54ffef7eb8
commit d0fffdab16
2 changed files with 7 additions and 6 deletions
+5 -6
View File
@@ -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;
}
+2
View File
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
570,
/**/
569,
/**/