xwayland: kinetic scroll doesn't work because stop events are not emitted
Applications running under XWayland don't receive scroll stop events. As a result, kinetic scroll doesn't work under XWayland.
The following hack can fix that. The Wayland server sends 2 scroll stop events when a toucpad scroll gesture ends. Translate that to a single X11 'smooth scroll' event with dx and dy both set to 0.
This is just a hack, maybe someone knowledegable can convert it to a proper fix.
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 9c574314d..fc214f2ef 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -629,6 +629,24 @@ static void
pointer_handle_axis_stop(void *data, struct wl_pointer *wl_pointer,
uint32_t time, uint32_t axis)
{
+ struct xwl_seat *xwl_seat = data;
+ ValuatorMask mask;
+
+ /* temporary hack */
+ static int toggle = 0;
+
+ toggle = 1 - toggle;
+
+ /* pointer_handle_axis_stop() is called once for each axis, however X sends only
+ a single event for both axes */
+ if (toggle)
+ return;
+
+ valuator_mask_zero(&mask);
+ valuator_mask_set_double(&mask, 3, 0);
+ valuator_mask_set_double(&mask, 2, 0);
+
+ QueuePointerEvents(xwl_seat->pointer, MotionNotify, 0, POINTER_RELATIVE, &mask);
}
static void
Edited by Yariv