aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2014-10-27 07:25:30 +0100
committertomaka <pierre.krieger1708@gmail.com>2014-10-27 07:25:30 +0100
commit18d9b493d73a51ebd0d1b337eae109fab157bbd8 (patch)
tree20efbc34154cff3cb3c61246c08ff649fbffa8a5
parent32eba169949bfb279cbc09e49801c63027c8a6ab (diff)
parent8fee1950c6bce0e35eed1a7442eed04c9653e0f3 (diff)
downloadglutin-18d9b493d73a51ebd0d1b337eae109fab157bbd8.tar.gz
glutin-18d9b493d73a51ebd0d1b337eae109fab157bbd8.zip
Merge pull request #78 from glennw/x11-wheel-events
Add support for mouse wheel events on x11.
-rw-r--r--src/x11/window/mod.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/x11/window/mod.rs b/src/x11/window/mod.rs
index d244d61..d848096 100644
--- a/src/x11/window/mod.rs
+++ b/src/x11/window/mod.rs
@@ -444,8 +444,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 };
@@ -454,8 +454,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
};