summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-09-15 08:01:41 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-09-15 08:01:41 +0300
commit8aaf00a911054c9066af838cf0fc10af7c724e01 (patch)
treec2bb27490e057e3c49d244cb512e2a7b67161e91
parentede6f53eff701e95428cf2d9b94a7248c9f10804 (diff)
macOS: Diff about a small SDL (2.0.12+) tweak
SDL 2.0.12 on macOS currently emulates a regular mouse wheel when swiping on the trackpad, which is not a great experience for GUI apps. Lagrange uses momentum scrolling, so these changes to SDL are needed to enable single-pixel mouse wheel increments.
-rw-r--r--sdl2-macos-mouse-scrolling-patch.diff28
1 files changed, 28 insertions, 0 deletions
diff --git a/sdl2-macos-mouse-scrolling-patch.diff b/sdl2-macos-mouse-scrolling-patch.diff
new file mode 100644
index 00000000..633243ed
--- /dev/null
+++ b/sdl2-macos-mouse-scrolling-patch.diff
@@ -0,0 +1,28 @@
1diff -r 4f06c06b6d19 src/events/SDL_mouse.c
2--- a/src/events/SDL_mouse.c Wed Aug 05 15:28:51 2020 +0200
3+++ b/src/events/SDL_mouse.c Tue Sep 15 07:54:17 2020 +0300
4@@ -642,8 +642,8 @@
5 event.wheel.preciseX = x;
6 event.wheel.preciseY = y;
7 #endif
8- event.wheel.x = integral_x;
9- event.wheel.y = integral_y;
10+ event.wheel.x = x; //integral_x;
11+ event.wheel.y = y; //integral_y;
12 event.wheel.direction = (Uint32)direction;
13 posted = (SDL_PushEvent(&event) > 0);
14 }
15diff -r 4f06c06b6d19 src/video/cocoa/SDL_cocoamouse.m
16--- a/src/video/cocoa/SDL_cocoamouse.m Wed Aug 05 15:28:51 2020 +0200
17+++ b/src/video/cocoa/SDL_cocoamouse.m Tue Sep 15 07:54:17 2020 +0300
18@@ -424,8 +424,8 @@
19 }
20
21 SDL_MouseID mouseID = mouse->mouseID;
22- CGFloat x = -[event deltaX];
23- CGFloat y = [event deltaY];
24+ CGFloat x = -[event scrollingDeltaX];
25+ CGFloat y = [event scrollingDeltaY];
26 SDL_MouseWheelDirection direction = SDL_MOUSEWHEEL_NORMAL;
27
28 if ([event respondsToSelector:@selector(isDirectionInvertedFromDevice)]) {