aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Watson <gw@intuitionlibrary.com>2014-10-27 14:51:44 +1000
committerGlenn Watson <gw@intuitionlibrary.com>2014-10-27 14:59:19 +1000
commit8fee1950c6bce0e35eed1a7442eed04c9653e0f3 (patch)
tree360032b8d9288e27d61f352eea017fb65fd86aa1
parent41d7118a424513e658279df877eafd4421e10dc3 (diff)
downloadglutin-8fee1950c6bce0e35eed1a7442eed04c9653e0f3.tar.gz
glutin-8fee1950c6bce0e35eed1a7442eed04c9653e0f3.zip
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 99cbf9d..a1cf0cc 100644
--- a/src/x11/window/mod.rs
+++ b/src/x11/window/mod.rs
@@ -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
};