Support horizontal scrolling on X11
This was previously bound to the mouse forwards/back buttons (canonically mouse 4 and 5).
This commit is contained in:
parent
025f34b80f
commit
9798d3ca86
|
@ -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::<xcb::ButtonPressEvent>(&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),
|
||||
|
|
Loading…
Reference in a new issue