diff options
author | Ton Roosendaal <ton@blender.org> | 2013-01-06 16:49:32 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2013-01-06 16:49:32 +0400 |
commit | 0fd4a102e0f312daf8c56fd22e611feeeaf7a992 (patch) | |
tree | 2b8b8907309caf16a93e185ef58b48a62eb3cb27 | |
parent | 927b2645d4f84a56d9c8b434415edf1eb279c43e (diff) |
With some help in irc (thanks erwin, markus!) and some googling, here's code
that compiles for OSX 10.6 for new momentumPhase usage.
Jens Verwiebe can give final blessings, I'm just copypasting stuff and test it :)
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCocoa.mm | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index ef87a498587..ac3e22368bc 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -1439,6 +1439,27 @@ bool GHOST_SystemCocoa::handleTabletEvent(void *eventPtr) } +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070 +enum { + NSEventPhaseNone = 0, + NSEventPhaseBegan = 0x1 << 0, + NSEventPhaseStationary = 0x1 << 1, + NSEventPhaseChanged = 0x1 << 2, + NSEventPhaseEnded = 0x1 << 3, + NSEventPhaseCancelled = 0x1 << 4, +}; +typedef NSUInteger NSEventPhase; + +@interface NSEvent (AvailableOn1070AndLater) +- (BOOL)hasPreciseScrollingDeltas; +- (CGFloat)scrollingDeltaX; +- (CGFloat)scrollingDeltaY; +- (NSEventPhase)momentumPhase; +- (BOOL)isDirectionInvertedFromDevice; +- (NSEventPhase)phase; +@end +#endif + GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) { NSEvent *event = (NSEvent *)eventPtr; @@ -1581,10 +1602,13 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) case NSScrollWheel: { - int momentum = [event momentumPhase]; + int *momentum = NULL; + + if ([event respondsToSelector:@selector(momentumPhase)]) + momentum = (int *)[event momentumPhase]; /* standard scrollwheel case, if no swiping happened, and no momentum (kinetic scroll) works */ - if (!m_hasMultiTouchTrackpad && momentum == 0) { + if (!m_hasMultiTouchTrackpad && momentum == NULL) { GHOST_TInt32 delta; double deltaF = [event deltaY]; |