From 63c0650321b774105ab8f3c5acbe933b5f5b4a2b Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Tue, 17 Feb 2026 10:23:57 -0500
Subject: [PATCH] Revert "MacOS: improve scroll smoothing"
This reverts commit 5dab2c73f0537bd121d2311b6949a654c5692af9.
We'll revisit this in the next SDL release.
Reference Issue #15058.
---
src/video/cocoa/SDL_cocoamouse.m | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m
index 17fb24452c31b..1cc1022be5a75 100644
--- a/src/video/cocoa/SDL_cocoamouse.m
+++ b/src/video/cocoa/SDL_cocoamouse.m
@@ -618,17 +618,27 @@ void Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event)
SDL_MouseWheelDirection direction;
CGFloat x, y;
- x = -[event scrollingDeltaX];
- y = [event scrollingDeltaY];
+ x = -[event deltaX];
+ y = [event deltaY];
direction = SDL_MOUSEWHEEL_NORMAL;
if ([event isDirectionInvertedFromDevice] == YES) {
direction = SDL_MOUSEWHEEL_FLIPPED;
}
- if ([event hasPreciseScrollingDeltas]) {
- x *= 0.1;
- y *= 0.1;
+ /* For discrete scroll events from conventional mice, always send a full tick.
+ For continuous scroll events from trackpads, send fractional deltas for smoother scrolling. */
+ 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);