diff --git a/src/x11/window.rs b/src/x11/window.rs index 5678fbd..2ad0cad 100644 --- a/src/x11/window.rs +++ b/src/x11/window.rs @@ -596,20 +596,17 @@ impl Window { let detail = event.detail(); match detail { - 4 => { + 4..=7 => { handler.on_event( &mut crate::Window::new(self), Event::Mouse(MouseEvent::WheelScrolled { - delta: ScrollDelta::Lines { x: 0.0, y: 1.0 }, - modifiers: key_mods(event.state()), - }), - ); - } - 5 => { - handler.on_event( - &mut crate::Window::new(self), - Event::Mouse(MouseEvent::WheelScrolled { - delta: ScrollDelta::Lines { x: 0.0, y: -1.0 }, + delta: match detail { + 4 => ScrollDelta::Lines { x: 0.0, y: 1.0 }, + 5 => ScrollDelta::Lines { x: 0.0, y: -1.0 }, + 6 => ScrollDelta::Lines { x: -1.0, y: 0.0 }, + 7 => ScrollDelta::Lines { x: 1.0, y: 0.0 }, + _ => unreachable!(), + }, modifiers: key_mods(event.state()), }), ); @@ -631,7 +628,7 @@ impl Window { let event = unsafe { xcb::cast_event::(&event) }; let detail = event.detail(); - if detail != 4 && detail != 5 { + if !(4..=7).contains(&detail) { let button_id = mouse_id(detail); handler.on_event( &mut crate::Window::new(self),