mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-23 22:01:31 +11:00
Merge pull request #78 from glennw/x11-wheel-events
Add support for mouse wheel events on x11.
This commit is contained in:
commit
18d9b493d7
|
@ -444,8 +444,8 @@ impl Window {
|
||||||
},
|
},
|
||||||
|
|
||||||
ffi::ButtonPress | ffi::ButtonRelease => {
|
ffi::ButtonPress | ffi::ButtonRelease => {
|
||||||
use {MouseInput, Pressed, Released};
|
use {MouseInput, MouseWheel, Pressed, Released};
|
||||||
use {LeftMouseButton, RightMouseButton, MiddleMouseButton, OtherMouseButton};
|
use {LeftMouseButton, RightMouseButton, MiddleMouseButton};
|
||||||
let event: &ffi::XButtonEvent = unsafe { mem::transmute(&xev) };
|
let event: &ffi::XButtonEvent = unsafe { mem::transmute(&xev) };
|
||||||
|
|
||||||
let state = if xev.type_ == ffi::ButtonPress { Pressed } else { Released };
|
let state = if xev.type_ == ffi::ButtonPress { Pressed } else { Released };
|
||||||
|
@ -454,8 +454,14 @@ impl Window {
|
||||||
ffi::Button1 => Some(LeftMouseButton),
|
ffi::Button1 => Some(LeftMouseButton),
|
||||||
ffi::Button2 => Some(MiddleMouseButton),
|
ffi::Button2 => Some(MiddleMouseButton),
|
||||||
ffi::Button3 => Some(RightMouseButton),
|
ffi::Button3 => Some(RightMouseButton),
|
||||||
ffi::Button4 => Some(OtherMouseButton(4)),
|
ffi::Button4 => {
|
||||||
ffi::Button5 => Some(OtherMouseButton(5)),
|
events.push(MouseWheel(1));
|
||||||
|
None
|
||||||
|
}
|
||||||
|
ffi::Button5 => {
|
||||||
|
events.push(MouseWheel(-1));
|
||||||
|
None
|
||||||
|
}
|
||||||
_ => None
|
_ => None
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue