From 39b79d88a5b05fd357d6397e795ed518d459309a Mon Sep 17 00:00:00 2001 From: Thomas Matthijs Date: Thu, 9 Oct 2025 00:28:26 +0200 Subject: [PATCH] slow scrolling chrome with emulation=wlroots capture=layer-shell (#318) (#325) Using niri as compositor on both sides resulting in: emulation=wlroots capture=layer-shell Mouse scrolling works fine in terminals, but only scrolls very small amount in google-chrome (in wayland mode) Using 'wev' to show events, using the real mouse shows [ 15: wl_pointer] axis_source: 0 (wheel) [ 15: wl_pointer] axis_value120: axis: 0 (vertical), value120: 120 [ 15: wl_pointer] axis_relative_direction: axis: 0 (vertical), direction: 0 [ 15: wl_pointer] axis: time: 50410752; axis: 0 (vertical), value: 15.000000 Using the lan-mouse shows: [ 15: wl_pointer] axis_source: 2 (continuous) [ 15: wl_pointer] axis_value120: axis: 0 (vertical), value120: 1 [ 15: wl_pointer] axis_relative_direction: axis: 0 (vertical), direction: 0 [ 15: wl_pointer] axis: time: -1913142096; axis: 0 (vertical), value: 20.000000 Without axis_source, scrolling over (pinned) tabs also skips one tab. --- input-emulation/src/wlroots.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/input-emulation/src/wlroots.rs b/input-emulation/src/wlroots.rs index 9c2e73a..51d6621 100644 --- a/input-emulation/src/wlroots.rs +++ b/input-emulation/src/wlroots.rs @@ -12,7 +12,7 @@ use wayland_client::backend::WaylandError; use wayland_client::WEnum; use wayland_client::protocol::wl_keyboard::{self, WlKeyboard}; -use wayland_client::protocol::wl_pointer::{Axis, ButtonState}; +use wayland_client::protocol::wl_pointer::{Axis, AxisSource, ButtonState}; use wayland_client::protocol::wl_seat::WlSeat; use wayland_protocols_wlr::virtual_pointer::v1::client::{ zwlr_virtual_pointer_manager_v1::ZwlrVirtualPointerManagerV1 as VpManager, @@ -210,7 +210,8 @@ impl VirtualInput { PointerEvent::AxisDiscrete120 { axis, value } => { let axis: Axis = (axis as u32).try_into()?; self.pointer - .axis_discrete(now, axis, value as f64 / 6., value / 120); + .axis_discrete(now, axis, value as f64 / 8., value); + self.pointer.axis_source(AxisSource::Wheel); self.pointer.frame(); } }