diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCocoa.h | 3 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCocoa.mm | 35 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowCocoa.mm | 10 |
3 files changed, 14 insertions, 34 deletions
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h index 3d6b40ee541..b49a7d8a0a3 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.h +++ b/intern/ghost/intern/GHOST_SystemCocoa.h @@ -297,9 +297,6 @@ protected: */ GHOST_TInt32 m_cursorDelta_x, m_cursorDelta_y; - /** Multitouch trackpad availability */ - bool m_hasMultiTouchTrackpad; - }; #endif // __GHOST_SYSTEMCOCOA_H__ diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index 37c2ac12315..f5dfe5a175b 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -370,8 +370,6 @@ GHOST_SystemCocoa::GHOST_SystemCocoa() rstring = (char*)malloc( len ); sysctl( mib, 2, rstring, &len, NULL, 0 ); - m_hasMultiTouchTrackpad = false; - free( rstring ); rstring = NULL; @@ -1223,10 +1221,10 @@ bool GHOST_SystemCocoa::handleTabletEvent(void *eventPtr) NSEvent *event = (NSEvent *)eventPtr; switch ([event subtype]) { - case NX_SUBTYPE_TABLET_POINT: + case NSTabletPointEventSubtype: handleTabletEvent(eventPtr, NSTabletPoint); return true; - case NX_SUBTYPE_TABLET_PROXIMITY: + case NSTabletProximityEventSubtype: handleTabletEvent(eventPtr, NSTabletProximity); return true; default: @@ -1390,25 +1388,22 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) } } break; - - /* these events only happen on swiping trackpads or tablets */ - /* warning: using tablet + trackpad at same time frustrates this static variable */ - case NSEventTypeBeginGesture: - m_hasMultiTouchTrackpad = 1; - break; - case NSEventTypeEndGesture: - m_hasMultiTouchTrackpad = 0; - break; - + case NSScrollWheel: { - int *momentum = NULL; + NSEventPhase momentum = NSEventPhaseNone; + NSEventPhase phase = NSEventPhaseNone; + bool hasMultiTouch = false; if ([event respondsToSelector:@selector(momentumPhase)]) - momentum = (int *)[event momentumPhase]; + momentum = [event momentumPhase]; + if ([event respondsToSelector:@selector(phase)]) + phase = [event phase]; + if ([event respondsToSelector:@selector(hasPreciseScrollingDeltas)]) + hasMultiTouch = [event hasPreciseScrollingDeltas]; /* standard scrollwheel case, if no swiping happened, and no momentum (kinetic scroll) works */ - if (!m_hasMultiTouchTrackpad && momentum == NULL) { + if (!hasMultiTouch && momentum == NSEventPhaseNone) { GHOST_TInt32 delta; double deltaF = [event deltaY]; @@ -1424,16 +1419,14 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) GHOST_TInt32 x, y; double dx; double dy; - + #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 - int phase = [event phase]; - /* with 10.7 nice scrolling deltas are supported */ dx = [event scrollingDeltaX]; dy = [event scrollingDeltaY]; /* however, wacom tablet (intuos5) needs old deltas, it then has momentum and phase at zero */ - if (phase == 0 && momentum==NULL) { + if (phase == NSEventPhaseNone && momentum == NSEventPhaseNone) { dx = [event deltaX]; dy = [event deltaY]; } diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm index 204d61de3df..38813e14a1b 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.mm +++ b/intern/ghost/intern/GHOST_WindowCocoa.mm @@ -393,16 +393,6 @@ enum { systemCocoa->handleMouseEvent(event); } -- (void)beginGestureWithEvent:(NSEvent *)event -{ - systemCocoa->handleMouseEvent(event); -} - -- (void)endGestureWithEvent:(NSEvent *)event -{ - systemCocoa->handleMouseEvent(event); -} - - (void)tabletPoint:(NSEvent *)event { systemCocoa->handleTabletEvent(event,[event type]); |