From edf19aae9a4f278352b7e84c9d07cbd40545a66a Mon Sep 17 00:00:00 2001 From: khyperia <953151+khyperia@users.noreply.github.com> Date: Mon, 29 Dec 2025 10:17:34 +0100 Subject: [PATCH 1/2] Add scroll accumulator for seats below version 8 --- src/ifs/wl_seat/event_handling.rs | 6 +++++- src/ifs/wl_seat/wl_pointer.rs | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ifs/wl_seat/event_handling.rs b/src/ifs/wl_seat/event_handling.rs index 6eda45e5..8b46b083 100644 --- a/src/ifs/wl_seat/event_handling.rs +++ b/src/ifs/wl_seat/event_handling.rs @@ -1459,7 +1459,11 @@ impl WlSeatGlobal { if p.seat.version >= AXIS_VALUE120_SINCE_VERSION { p.send_axis_value120(axis, delta); } else if p.seat.version >= AXIS_DISCRETE_SINCE_VERSION { - p.send_axis_discrete(axis, delta / AXIS_120); + let mut accumulator = p.v120_accumulator[i].get(); + accumulator += delta; + p.send_axis_discrete(axis, accumulator / AXIS_120); + accumulator %= AXIS_120; + p.v120_accumulator[i].set(accumulator); } } if let Some(delta) = event.px[i].get() { diff --git a/src/ifs/wl_seat/wl_pointer.rs b/src/ifs/wl_seat/wl_pointer.rs index bb6a3eb6..affb2ac0 100644 --- a/src/ifs/wl_seat/wl_pointer.rs +++ b/src/ifs/wl_seat/wl_pointer.rs @@ -74,6 +74,7 @@ pub struct WlPointer { pub seat: Rc, pub tracker: Tracker, last_motion: Cell<(Fixed, Fixed)>, + pub v120_accumulator: [Cell; 2], } impl WlPointer { @@ -83,6 +84,7 @@ impl WlPointer { seat: seat.clone(), tracker: Default::default(), last_motion: Default::default(), + v120_accumulator: Default::default(), } } From 57cdc162bfc049b7a1f9a93217bf3cbaa9bf6b0b Mon Sep 17 00:00:00 2001 From: khyperia <953151+khyperia@users.noreply.github.com> Date: Tue, 30 Dec 2025 09:45:10 +0100 Subject: [PATCH 2/2] Reset scroll accumulator on stop and pointer enter surface --- src/ifs/wl_seat/event_handling.rs | 7 +++++-- src/ifs/wl_seat/wl_pointer.rs | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ifs/wl_seat/event_handling.rs b/src/ifs/wl_seat/event_handling.rs index 8b46b083..ddec3ad8 100644 --- a/src/ifs/wl_seat/event_handling.rs +++ b/src/ifs/wl_seat/event_handling.rs @@ -1476,8 +1476,11 @@ impl WlSeatGlobal { } p.send_axis(time, axis, delta); } - if p.seat.version >= AXIS_STOP_SINCE_VERSION && event.stop[i].get() { - p.send_axis_stop(time, axis); + if event.stop[i].get() { + if p.seat.version >= AXIS_STOP_SINCE_VERSION { + p.send_axis_stop(time, axis); + } + p.v120_accumulator[i].set(0); } } if p.seat.version >= POINTER_FRAME_SINCE_VERSION { diff --git a/src/ifs/wl_seat/wl_pointer.rs b/src/ifs/wl_seat/wl_pointer.rs index affb2ac0..3325b1fe 100644 --- a/src/ifs/wl_seat/wl_pointer.rs +++ b/src/ifs/wl_seat/wl_pointer.rs @@ -90,6 +90,9 @@ impl WlPointer { pub fn send_enter(&self, serial: u64, surface: WlSurfaceId, mut x: Fixed, mut y: Fixed) { self.last_motion.set((x, y)); + for accumulator in &self.v120_accumulator { + accumulator.set(0); + } logical_to_client_wire_scale!(self.seat.client, x, y); self.seat.client.event(Enter { self_id: self.id,