diff options
author | Ton Roosendaal <ton@blender.org> | 2012-12-28 23:10:21 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2012-12-28 23:10:21 +0400 |
commit | 4e24bcf6c98d0a76288ac61e8d4c910d6e34933a (patch) | |
tree | 1716e64f805167f9e0ce890c15288fedc3176886 /intern | |
parent | cfd0b3c5f2efc80ae0276721b5cae0686cf94093 (diff) |
Testing commit for OS X trackpad and scroll events.
Now:
- code is wrapped for OS X releases (10.6 and 10.7)
- It now detects scrollwheel (old mouse) and gesture strokes (mighty mouse or trackpad).
If you have 10.6, things will work as for release.
Next todo for tomorrow: make trackpad work actually smooth and not with steps.
Will also try to figure out the device type, to handle mighty mouse differently.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCocoa.mm | 14 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowCocoa.mm | 5 |
2 files changed, 18 insertions, 1 deletions
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index 39fd038d568..a32759feb59 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -1577,9 +1577,21 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) } break; + case NSEventTypeBeginGesture: + m_hasMultiTouchTrackpad = true; + break; + case NSEventTypeEndGesture: + m_hasMultiTouchTrackpad = false; + break; + case NSScrollWheel: { - if (!m_hasMultiTouchTrackpad) { + int momentum = 0; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 + momentum = [event momentumPhase]; +#endif + + if (!m_hasMultiTouchTrackpad && momentum==0) { GHOST_TInt32 delta; double deltaF = [event deltaY]; diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm index 471505538ba..bceb795c47d 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.mm +++ b/intern/ghost/intern/GHOST_WindowCocoa.mm @@ -595,6 +595,11 @@ GHOST_WindowCocoa::GHOST_WindowCocoa( [m_window setAcceptsMouseMovedEvents:YES]; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 + NSView *view = [m_window contentView]; + [view setAcceptsTouchEvents:YES]; +#endif + [m_window registerForDraggedTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, NSStringPboardType, NSTIFFPboardType, nil]]; |