Revert "MacOS: improve scroll smoothing"

This reverts commit 5dab2c73f0.

We'll revisit this in the next SDL release.

Reference Issue #15058.
This commit is contained in:
Ryan C. Gordon
2026-02-17 10:23:57 -05:00
parent f0bda7b655
commit 63c0650321

View File

@@ -618,17 +618,27 @@ void Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event)
SDL_MouseWheelDirection direction; SDL_MouseWheelDirection direction;
CGFloat x, y; CGFloat x, y;
x = -[event scrollingDeltaX]; x = -[event deltaX];
y = [event scrollingDeltaY]; y = [event deltaY];
direction = SDL_MOUSEWHEEL_NORMAL; direction = SDL_MOUSEWHEEL_NORMAL;
if ([event isDirectionInvertedFromDevice] == YES) { if ([event isDirectionInvertedFromDevice] == YES) {
direction = SDL_MOUSEWHEEL_FLIPPED; direction = SDL_MOUSEWHEEL_FLIPPED;
} }
if ([event hasPreciseScrollingDeltas]) { /* For discrete scroll events from conventional mice, always send a full tick.
x *= 0.1; For continuous scroll events from trackpads, send fractional deltas for smoother scrolling. */
y *= 0.1; if (![event hasPreciseScrollingDeltas]) {
if (x > 0) {
x = SDL_ceil(x);
} else if (x < 0) {
x = SDL_floor(x);
}
if (y > 0) {
y = SDL_ceil(y);
} else if (y < 0) {
y = SDL_floor(y);
}
} }
SDL_SendMouseWheel(Cocoa_GetEventTimestamp([event timestamp]), window, mouseID, x, y, direction); SDL_SendMouseWheel(Cocoa_GetEventTimestamp([event timestamp]), window, mouseID, x, y, direction);