Add support for mouse wheel events on x11.

This commit is contained in:
Glenn Watson 2014-10-27 14:51:44 +10:00
parent 41d7118a42
commit 8fee1950c6

View file

@ -414,8 +414,8 @@ impl Window {
},
ffi::ButtonPress | ffi::ButtonRelease => {
use {MouseInput, Pressed, Released};
use {LeftMouseButton, RightMouseButton, MiddleMouseButton, OtherMouseButton};
use {MouseInput, MouseWheel, Pressed, Released};
use {LeftMouseButton, RightMouseButton, MiddleMouseButton};
let event: &ffi::XButtonEvent = unsafe { mem::transmute(&xev) };
let state = if xev.type_ == ffi::ButtonPress { Pressed } else { Released };
@ -424,8 +424,14 @@ impl Window {
ffi::Button1 => Some(LeftMouseButton),
ffi::Button2 => Some(MiddleMouseButton),
ffi::Button3 => Some(RightMouseButton),
ffi::Button4 => Some(OtherMouseButton(4)),
ffi::Button5 => Some(OtherMouseButton(5)),
ffi::Button4 => {
events.push(MouseWheel(1));
None
}
ffi::Button5 => {
events.push(MouseWheel(-1));
None
}
_ => None
};