aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2016-02-02 10:53:11 +0100
committertomaka <pierre.krieger1708@gmail.com>2016-02-02 10:53:11 +0100
commitb63070db25173826c669551514acdefe76a15885 (patch)
tree8a760e7b8103576bd289257bce86e257e86d1bb4 /src
parent5288b7dfc63179549ef579c29a477b43ea409218 (diff)
parent99073eec7b1549ead1a62b67e205a80d02053dba (diff)
downloadglutin-b63070db25173826c669551514acdefe76a15885.tar.gz
glutin-b63070db25173826c669551514acdefe76a15885.zip
Merge pull request #718 from paulrouget/hidpiwheel
osx: scroll delta should take hidpi factor into account
Diffstat (limited to 'src')
-rw-r--r--src/api/cocoa/mod.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/api/cocoa/mod.rs b/src/api/cocoa/mod.rs
index 138a448..66244d8 100644
--- a/src/api/cocoa/mod.rs
+++ b/src/api/cocoa/mod.rs
@@ -881,10 +881,13 @@ unsafe fn NSEventToEvent(window: &Window, nsevent: id) -> Option<Event> {
},
NSScrollWheel => {
use events::MouseScrollDelta::{LineDelta, PixelDelta};
+ let scale_factor = window.hidpi_factor();
let delta = if nsevent.hasPreciseScrollingDeltas() == YES {
- PixelDelta(nsevent.scrollingDeltaX() as f32, nsevent.scrollingDeltaY() as f32)
+ PixelDelta(scale_factor * nsevent.scrollingDeltaX() as f32,
+ scale_factor * nsevent.scrollingDeltaY() as f32)
} else {
- LineDelta(nsevent.scrollingDeltaX() as f32, nsevent.scrollingDeltaY() as f32)
+ LineDelta(scale_factor * nsevent.scrollingDeltaX() as f32,
+ scale_factor * nsevent.scrollingDeltaY() as f32)
};
Some(MouseWheel(delta))
},