Change #6800: [OSX] Use high-precision scrolling deltas for 2D scrolling

This commit is contained in:
Alexander Weiss 2019-01-26 16:22:18 +01:00 committed by Michael Lutz
parent 195fd0dc60
commit 0bb395b21d
1 changed files with 19 additions and 3 deletions

View File

@ -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)