| 1 | --- src/osx/cocoa/window.mm (revision 72169) |
| 2 | +++ src/osx/cocoa/window.mm (revision 72195) |
| 3 | @@ -456,4 +456,9 @@ |
| 4 | - (CGFloat)deviceDeltaX; |
| 5 | - (CGFloat)deviceDeltaY; |
| 6 | + |
| 7 | +// 10.7+ |
| 8 | +- (BOOL)hasPreciseScrollingDeltas; |
| 9 | +- (CGFloat)scrollingDeltaX; |
| 10 | +- (CGFloat)scrollingDeltaY; |
| 11 | @end |
| 12 | |
| 13 | @@ -610,21 +615,37 @@ |
| 14 | wxevent.SetEventType( wxEVT_MOUSEWHEEL ) ; |
| 15 | |
| 16 | - // see http://developer.apple.com/qa/qa2005/qa1453.html |
| 17 | - // for more details on why we have to look for the exact type |
| 18 | - |
| 19 | - const EventRef cEvent = (EventRef) [nsEvent eventRef]; |
| 20 | - bool isMouseScrollEvent = false; |
| 21 | - if ( cEvent ) |
| 22 | - isMouseScrollEvent = ::GetEventKind(cEvent) == kEventMouseScroll; |
| 23 | - |
| 24 | - if ( isMouseScrollEvent ) |
| 25 | + if ( UMAGetSystemVersion() >= 0x1070 ) |
| 26 | { |
| 27 | - deltaX = [nsEvent deviceDeltaX]; |
| 28 | - deltaY = [nsEvent deviceDeltaY]; |
| 29 | + if ( [nsEvent hasPreciseScrollingDeltas] ) |
| 30 | + { |
| 31 | + deltaX = [nsEvent scrollingDeltaX]; |
| 32 | + deltaY = [nsEvent scrollingDeltaY]; |
| 33 | + } |
| 34 | + else |
| 35 | + { |
| 36 | + deltaX = [nsEvent scrollingDeltaX] * 10; |
| 37 | + deltaY = [nsEvent scrollingDeltaY] * 10; |
| 38 | + } |
| 39 | } |
| 40 | else |
| 41 | { |
| 42 | - deltaX = ([nsEvent deltaX] * 10); |
| 43 | - deltaY = ([nsEvent deltaY] * 10); |
| 44 | + const EventRef cEvent = (EventRef) [nsEvent eventRef]; |
| 45 | + // see http://developer.apple.com/qa/qa2005/qa1453.html |
| 46 | + // for more details on why we have to look for the exact type |
| 47 | + |
| 48 | + bool isMouseScrollEvent = false; |
| 49 | + if ( cEvent ) |
| 50 | + isMouseScrollEvent = ::GetEventKind(cEvent) == kEventMouseScroll; |
| 51 | + |
| 52 | + if ( isMouseScrollEvent ) |
| 53 | + { |
| 54 | + deltaX = [nsEvent deviceDeltaX]; |
| 55 | + deltaY = [nsEvent deviceDeltaY]; |
| 56 | + } |
| 57 | + else |
| 58 | + { |
| 59 | + deltaX = ([nsEvent deltaX] * 10); |
| 60 | + deltaY = ([nsEvent deltaY] * 10); |
| 61 | + } |
| 62 | } |
| 63 | |