From 4a80088ad81a854b28e23b77e5dc1e3b438736bc Mon Sep 17 00:00:00 2001 From: Hilmi Abroor <165367448+uint82@users.noreply.github.com> Date: Wed, 8 Jul 2026 19:59:09 +0700 Subject: [PATCH 1/2] Improve handling of scroll wheel events Refactor scroll wheel event handling to check for axis presence. --- src/linux/wayland/listen.rs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/linux/wayland/listen.rs b/src/linux/wayland/listen.rs index 761e161f..4469f645 100644 --- a/src/linux/wayland/listen.rs +++ b/src/linux/wayland/listen.rs @@ -51,10 +51,21 @@ fn convert_type(libevent: LibEvent) -> Option { x: btn.absolute_x(), y: btn.absolute_y(), }), - LibEvent::Pointer(PointerEvent::ScrollWheel(btn)) => Some(EventType::Wheel { - delta_x: -(btn.scroll_value_v120(Axis::Horizontal) / 120.0) as i64, - delta_y: -(btn.scroll_value_v120(Axis::Vertical) / 120.0) as i64, - }), + LibEvent::Pointer(PointerEvent::ScrollWheel(btn)) => { + let delta_x = if btn.has_axis(Axis::Horizontal) { + -(btn.scroll_value_v120(Axis::Horizontal) / 120.0) as i64 + } else { + 0 + }; + + let delta_y = if btn.has_axis(Axis::Vertical) { + -(btn.scroll_value_v120(Axis::Vertical) / 120.0) as i64 + } else { + 0 + }; + + Some(EventType::Wheel { delta_x, delta_y }) + } _ => { // dbg!(format!("Received unhandlded event {lib:?}")); None From e39ba411c278d68310477d9a42645e1d5af2aa22 Mon Sep 17 00:00:00 2001 From: Hilmi Abroor <165367448+uint82@users.noreply.github.com> Date: Wed, 8 Jul 2026 20:01:44 +0700 Subject: [PATCH 2/2] Add PointerScrollEvent to listen.rs --- src/linux/wayland/listen.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/linux/wayland/listen.rs b/src/linux/wayland/listen.rs index 4469f645..dd77ac9f 100644 --- a/src/linux/wayland/listen.rs +++ b/src/linux/wayland/listen.rs @@ -5,7 +5,7 @@ use crate::rdev::{Event, KeyboardState, ListenError}; use crate::{Button, EventType}; use input::event::PointerEvent; use input::event::keyboard::{KeyState, KeyboardEventTrait}; -use input::event::pointer::{Axis, ButtonState}; +use input::event::pointer::{Axis, ButtonState, PointerScrollEvent}; use input::{Event as LibEvent, Libinput, LibinputInterface}; use libc::{O_RDONLY, O_RDWR, O_WRONLY}; use std::fs::{File, OpenOptions};