aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/cocoa
diff options
context:
space:
mode:
authorRobert Knight <robertknight@gmail.com>2015-06-14 18:09:02 +0100
committerRobert Knight <robertknight@gmail.com>2015-06-14 18:09:02 +0100
commit5b08220df5cbdf16ee2879a5889cdaaa1f89984e (patch)
treea9357520d0479056b53cddb464fd4a668f7ff433 /src/api/cocoa
parent5e626b7fdf1942af9c3f1faade1eba6ecd47e0ca (diff)
downloadglutin-5b08220df5cbdf16ee2879a5889cdaaa1f89984e.tar.gz
glutin-5b08220df5cbdf16ee2879a5889cdaaa1f89984e.zip
Report scroll deltas in lines for non-touch devices on OS X
Scroll deltas on OS X may be reported either as pixel deltas to scroll by if supported by the device or line/row deltas otherwise.
Diffstat (limited to 'src/api/cocoa')
-rw-r--r--src/api/cocoa/mod.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/api/cocoa/mod.rs b/src/api/cocoa/mod.rs
index 43628ea..877aba7 100644
--- a/src/api/cocoa/mod.rs
+++ b/src/api/cocoa/mod.rs
@@ -276,8 +276,12 @@ impl<'a> Iterator for PollEventsIterator<'a> {
event
},
NSScrollWheel => {
- use events::MouseScrollDelta::PixelDelta;
- let delta = PixelDelta(event.scrollingDeltaX() as f32, event.scrollingDeltaY() as f32);
+ use events::MouseScrollDelta::{LineDelta, PixelDelta};
+ let delta = if event.hasPreciseScrollingDeltas() == YES {
+ PixelDelta(event.scrollingDeltaX() as f32, event.scrollingDeltaY() as f32)
+ } else {
+ LineDelta(event.scrollingDeltaX() as f32, event.scrollingDeltaY() as f32)
+ };
Some(MouseWheel(delta))
},
_ => { None },