diff options
author | Paul Rouget <me@paulrouget.com> | 2016-03-04 01:28:43 +0100 |
---|---|---|
committer | Paul Rouget <me@paulrouget.com> | 2016-03-04 01:28:43 +0100 |
commit | e843206c1303475678482f623477408468b8a74b (patch) | |
tree | 1243ddf9e5b337b0b8ad91eabc269ce429072a4b /src/api/cocoa | |
parent | 2638db665afc175cf128c3e25bc883f4c114bb5a (diff) | |
parent | 7886ff9acdbc4961359725536c1a15e2cbb3d4f5 (diff) | |
download | glutin-e843206c1303475678482f623477408468b8a74b.tar.gz glutin-e843206c1303475678482f623477408468b8a74b.zip |
Merge pull request #735 from metajack/overscroll-tomaka
Add phases to wheel events.
Diffstat (limited to 'src/api/cocoa')
-rw-r--r-- | src/api/cocoa/mod.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/api/cocoa/mod.rs b/src/api/cocoa/mod.rs index abcd735..db3f749 100644 --- a/src/api/cocoa/mod.rs +++ b/src/api/cocoa/mod.rs @@ -42,10 +42,10 @@ use std::sync::Mutex; use std::ascii::AsciiExt; use std::ops::Deref; -use events::Event::{Awakened, MouseInput, MouseMoved, ReceivedCharacter, KeyboardInput, MouseWheel, Closed, Focused, TouchpadPressure}; use events::ElementState::{Pressed, Released}; -use events::MouseButton; -use events; +use events::Event::{Awakened, MouseInput, MouseMoved, ReceivedCharacter, KeyboardInput}; +use events::Event::{MouseWheel, Closed, Focused, TouchpadPressure}; +use events::{self, MouseButton, TouchPhase}; pub use self::monitor::{MonitorId, get_available_monitors, get_primary_monitor}; pub use self::headless::HeadlessContext; @@ -891,7 +891,12 @@ unsafe fn NSEventToEvent(window: &Window, nsevent: id) -> Option<Event> { LineDelta(scale_factor * nsevent.scrollingDeltaX() as f32, scale_factor * nsevent.scrollingDeltaY() as f32) }; - Some(MouseWheel(delta)) + let phase = match nsevent.phase() { + NSEventPhaseMayBegin | NSEventPhaseBegan => TouchPhase::Started, + NSEventPhaseEnded => TouchPhase::Ended, + _ => TouchPhase::Moved, + }; + Some(MouseWheel(delta, phase)) }, NSEventTypePressure => { Some(TouchpadPressure(nsevent.pressure(), nsevent.stage())) |