summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/video/cocoa/event.mm22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/video/cocoa/event.mm b/src/video/cocoa/event.mm
index 30b6563b6..77f683af8 100644
--- a/src/video/cocoa/event.mm
+++ b/src/video/cocoa/event.mm
@@ -575,9 +575,25 @@ static bool QZ_PollEvent()
_cursor.wheel++;
} /* else: deltaY was 0.0 and we don't want to do anything */
- /* Set the scroll count for scrollwheel scrolling */
- _cursor.h_wheel -= (int)([ event deltaX ] * 5 * _settings_client.gui.scrollwheel_multiplier);
- _cursor.v_wheel -= (int)([ event deltaY ] * 5 * _settings_client.gui.scrollwheel_multiplier);
+ /* Update the scroll count for 2D scrolling */
+ CGFloat deltaX;
+ CGFloat deltaY;
+
+ /* Use precise scrolling-specific deltas if they're supported. */
+#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
+ if ([event respondsToSelector:@selector(scrollingDeltaX)]) {
+ deltaX = [ event scrollingDeltaX ] * 0.5f;
+ deltaY = [ event scrollingDeltaY ] * 0.5f;
+ } else
+#endif
+ {
+ deltaX = [ event deltaX ] * 5;
+ deltaY = [ event deltaY ] * 5;
+ }
+
+ _cursor.h_wheel -= (int)(deltaX * _settings_client.gui.scrollwheel_multiplier);
+ _cursor.v_wheel -= (int)(deltaY * _settings_client.gui.scrollwheel_multiplier);
+
break;
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)