comparison src/gui_gtk_x11.c @ 34291:af33a7e1c205 v9.1.0081

patch 9.1.0081: X11 mouse-scrolling stutters Commit: https://github.com/vim/vim/commit/1efb1b08a142560af50f7e68c935f067944742a3 Author: lilydjwg <lilydjwg@gmail.com> Date: Thu Feb 8 11:04:21 2024 +0100 patch 9.1.0081: X11 mouse-scrolling stutters Problem: X11 mouse-scrolling stutters (Ron Aaron, after 9.1.0064) Solution: Handle GDK_SCROLL_SMOOTH fractional distance events (lilydjwg) I don't know why, but with GDK_SMOOTH_SCROLL_MASK we get wheel events as GDK_SCROLL_SMOOTH. What's more, one wheel scroll is counted as 1.5 distance in Wayland but 1.0 in X11. I failed to find any docs on gtk.org about this. fixes: #13987 closes: #13991 Signed-off-by: lilydjwg <lilydjwg@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Thu, 08 Feb 2024 11:15:06 +0100
parents efc8334c1d77
children 0b85121f25e0
comparison
equal deleted inserted replaced
34290:167d80fce1b1 34291:af33a7e1c205
2103 vim_modifiers = modifiers_gdk2mouse(event->state); 2103 vim_modifiers = modifiers_gdk2mouse(event->state);
2104 2104
2105 #if GTK_CHECK_VERSION(3,4,0) 2105 #if GTK_CHECK_VERSION(3,4,0)
2106 if (event->direction == GDK_SCROLL_SMOOTH) 2106 if (event->direction == GDK_SCROLL_SMOOTH)
2107 { 2107 {
2108 while (acc_x > 1.0) 2108 while (acc_x >= 1.0)
2109 { // right 2109 { // right
2110 acc_x = MAX(0.0, acc_x - 1.0); 2110 acc_x = MAX(0.0, acc_x - 1.0);
2111 gui_send_mouse_event(MOUSE_6, (int)event->x, (int)event->y, 2111 gui_send_mouse_event(MOUSE_6, (int)event->x, (int)event->y,
2112 FALSE, vim_modifiers); 2112 FALSE, vim_modifiers);
2113 } 2113 }
2114 while (acc_x < -1.0) 2114 while (acc_x <= -1.0)
2115 { // left 2115 { // left
2116 acc_x = MIN(0.0, acc_x + 1.0); 2116 acc_x = MIN(0.0, acc_x + 1.0);
2117 gui_send_mouse_event(MOUSE_7, (int)event->x, (int)event->y, 2117 gui_send_mouse_event(MOUSE_7, (int)event->x, (int)event->y,
2118 FALSE, vim_modifiers); 2118 FALSE, vim_modifiers);
2119 } 2119 }
2120 while (acc_y > 1.0) 2120 while (acc_y >= 1.0)
2121 { // down 2121 { // down
2122 acc_y = MAX(0.0, acc_y - 1.0); 2122 acc_y = MAX(0.0, acc_y - 1.0);
2123 gui_send_mouse_event(MOUSE_5, (int)event->x, (int)event->y, 2123 gui_send_mouse_event(MOUSE_5, (int)event->x, (int)event->y,
2124 FALSE, vim_modifiers); 2124 FALSE, vim_modifiers);
2125 } 2125 }
2126 while (acc_y < -1.0) 2126 while (acc_y <= -1.0)
2127 { // up 2127 { // up
2128 acc_y = MIN(0.0, acc_y + 1.0); 2128 acc_y = MIN(0.0, acc_y + 1.0);
2129 gui_send_mouse_event(MOUSE_4, (int)event->x, (int)event->y, 2129 gui_send_mouse_event(MOUSE_4, (int)event->x, (int)event->y,
2130 FALSE, vim_modifiers); 2130 FALSE, vim_modifiers);
2131 } 2131 }