From 27e6b7a119d91045e7f840e21a4ddf6e764761b9 Mon Sep 17 00:00:00 2001
From: Isabella Basso <[EMAIL REDACTED]>
Date: Mon, 6 Jul 2026 17:13:04 -0300
Subject: [PATCH] cocoa: restore discrete mouse wheel ticks
(cherry picked from commit 1f3f71439308e9469480b2fe0061e9b99cbc2773)
---
src/video/cocoa/SDL_cocoamouse.m | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m
index 1cc1022be5a75..dd24896468528 100644
--- a/src/video/cocoa/SDL_cocoamouse.m
+++ b/src/video/cocoa/SDL_cocoamouse.m
@@ -618,17 +618,18 @@ void Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event)
SDL_MouseWheelDirection direction;
CGFloat x, y;
- x = -[event deltaX];
- y = [event deltaY];
direction = SDL_MOUSEWHEEL_NORMAL;
if ([event isDirectionInvertedFromDevice] == YES) {
direction = SDL_MOUSEWHEEL_FLIPPED;
}
- /* 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 ([event hasPreciseScrollingDeltas]) {
+ x = -[event scrollingDeltaX] * 0.1f;
+ y = [event scrollingDeltaY] * 0.1f;
+ } else {
+ x = -[event deltaX];
+ y = [event deltaY];
if (x > 0) {
x = SDL_ceil(x);
} else if (x < 0) {