Skip to content

Instantly share code, notes, and snippets.

@TheBlckbird
Created January 29, 2026 12:49
Show Gist options
  • Select an option

  • Save TheBlckbird/eba1fa02543bd9eb19e33c825be4ebbf to your computer and use it in GitHub Desktop.

Select an option

Save TheBlckbird/eba1fa02543bd9eb19e33c825be4ebbf to your computer and use it in GitHub Desktop.
SDL3 patch to fix scrolling on MacOS in Terraria
diff -u a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m
--- a/src/video/cocoa/SDL_cocoamouse.m 2025-11-20 13:51:22
+++ b/src/video/cocoa/SDL_cocoamouse.m 2026-01-29 13:40:03
@@ -615,8 +615,22 @@
SDL_MouseWheelDirection direction;
CGFloat x, y;
- x = -[event scrollingDeltaX];
- y = [event scrollingDeltaY];
+ // x = -[event scrollingDeltaX];
+ // y = [event scrollingDeltaY];
+
+
+ if ([event scrollingDeltaX] < 0) {
+ x = 1;
+ } else {
+ x = -1;
+ }
+
+ if ([event scrollingDeltaY] < 0) {
+ y = -1;
+ } else {
+ y = 1;
+ }
+
direction = SDL_MOUSEWHEEL_NORMAL;
if ([event isDirectionInvertedFromDevice] == YES) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment