aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/cocoa
diff options
context:
space:
mode:
authorPierre Krieger <pierre.krieger1708@gmail.com>2016-02-09 15:20:06 +0100
committerPierre Krieger <pierre.krieger1708@gmail.com>2016-02-09 15:20:06 +0100
commit9238a48ffca5be87b27bca9c6bc391930871b823 (patch)
treecfca45fed6902d43703ff70d183572e1a0b787f3 /src/api/cocoa
parent5cce3f9640b9ec3e78619d3e8f41f0e7b316dde0 (diff)
parent75a940d4f1240fff9adeed9b0ff869e9aa0f5814 (diff)
downloadglutin-9238a48ffca5be87b27bca9c6bc391930871b823.tar.gz
glutin-9238a48ffca5be87b27bca9c6bc391930871b823.zip
Merge branch 'master' of http://github.com/tomaka/gl-init-rs
Diffstat (limited to 'src/api/cocoa')
-rw-r--r--src/api/cocoa/mod.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/api/cocoa/mod.rs b/src/api/cocoa/mod.rs
index 138a448..d35182e 100644
--- a/src/api/cocoa/mod.rs
+++ b/src/api/cocoa/mod.rs
@@ -837,9 +837,7 @@ unsafe fn NSEventToEvent(window: &Window, nsevent: id) -> Option<Event> {
let received_c_str = nsevent.characters().UTF8String();
let received_str = CStr::from_ptr(received_c_str);
for received_char in from_utf8(received_str.to_bytes()).unwrap().chars() {
- if received_char.is_ascii() {
- events.push_back(ReceivedCharacter(received_char));
- }
+ events.push_back(ReceivedCharacter(received_char));
}
let vkey = event::vkeycode_to_element(NSEvent::keyCode(nsevent));
@@ -881,10 +879,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))
},