From cce69c559d93e6fcc158ef64eb6e8030fbd4ce8f Mon Sep 17 00:00:00 2001 From: Nicolas Cellier Date: Fri, 27 Dec 2019 18:10:51 +0100 Subject: [PATCH] Use precise scrolling deltas if available on OSX --- .../vm/OSX/sqSqueakOSXApplication+events.m | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m b/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m index 1278b977c1..8c9cd6f692 100644 --- a/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m +++ b/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m @@ -263,8 +263,23 @@ - (void) recordMouseEvent:(NSEvent *)theEvent fromView: (NSView *) aView{ [self recordMouseEvent: theEvent fromView: aView]; +#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7) + CGFloat x = [theEvent scrollingDeltaX]; + CGFloat y = [theEvent scrollingDeltaY]; + int xDelta = x * 120; + int yDelta = y * 120; + if ([theEvent respondsToSelector:@selector(hasPreciseScrollingDeltas)]) { + if ([theEvent hasPreciseScrollingDeltas]) { + xDelta = x; + yDelta = y; + } + } +#else CGFloat x = [theEvent deltaX]; CGFloat y = [theEvent deltaY]; + int xDelta = x * 120; + int yDelta = y * 120; +#endif if (sendWheelEvents) { sqMouseEvent evt; @@ -273,8 +288,8 @@ - (void) recordWheelEvent:(NSEvent *) theEvent fromView: (NSView