diff options
author | tomaka <pierre.krieger1708@gmail.com> | 2015-06-16 08:52:25 +0200 |
---|---|---|
committer | tomaka <pierre.krieger1708@gmail.com> | 2015-06-16 08:52:25 +0200 |
commit | 5e8271dad0a56697f0729c094dfe29cab302460b (patch) | |
tree | 07901f0a48dc1426d034bbb39dfed100cc3e7a40 /src/api/x11 | |
parent | a0e29d9410181368eee1e0b6db1bbbf11abf45f8 (diff) | |
parent | b2c2f300dce0b874efee4c328629ff9c2316c056 (diff) | |
download | glutin-5e8271dad0a56697f0729c094dfe29cab302460b.tar.gz glutin-5e8271dad0a56697f0729c094dfe29cab302460b.zip |
Merge pull request #483 from robertknight/rob-precise_scroll_deltas
Specify scroll deltas as either line or pixel-based
Diffstat (limited to 'src/api/x11')
-rw-r--r-- | src/api/x11/window.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/api/x11/window.rs b/src/api/x11/window.rs index 8b74e77..55ee007 100644 --- a/src/api/x11/window.rs +++ b/src/api/x11/window.rs @@ -219,6 +219,7 @@ impl<'a> Iterator for PollEventsIterator<'a> { use events::Event::{MouseInput, MouseWheel}; use events::ElementState::{Pressed, Released}; use events::MouseButton::{Left, Right, Middle}; + use events::MouseScrollDelta::{LineDelta}; let event: &ffi::XButtonEvent = unsafe { mem::transmute(&xev) }; @@ -229,11 +230,13 @@ impl<'a> Iterator for PollEventsIterator<'a> { ffi::Button2 => Some(Middle), ffi::Button3 => Some(Right), ffi::Button4 => { - self.window.pending_events.lock().unwrap().push_back(MouseWheel(0.0, 1.0)); + let delta = LineDelta(0.0, 1.0); + self.window.pending_events.lock().unwrap().push_back(MouseWheel(delta)); None } ffi::Button5 => { - self.window.pending_events.lock().unwrap().push_back(MouseWheel(0.0, -1.0)); + let delta = LineDelta(0.0, -1.0); + self.window.pending_events.lock().unwrap().push_back(MouseWheel(delta)); None } _ => None |