Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OSX] Use high-precision scrolling properties for 2D scrolling #7109

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 22 additions & 3 deletions src/video/cocoa/event.mm
Expand Up @@ -575,9 +575,28 @@ 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(hasPreciseScrollingDeltas)]) {
/* No precise deltas indicates a scroll wheel is being used, so we don't want 2D scrolling. */
if (![ event hasPreciseScrollingDeltas ]) break;

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)
Expand Down