From 8aaf00a911054c9066af838cf0fc10af7c724e01 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Tue, 15 Sep 2020 08:01:41 +0300 Subject: 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. --- sdl2-macos-mouse-scrolling-patch.diff | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 sdl2-macos-mouse-scrolling-patch.diff 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 @@ +diff -r 4f06c06b6d19 src/events/SDL_mouse.c +--- a/src/events/SDL_mouse.c Wed Aug 05 15:28:51 2020 +0200 ++++ b/src/events/SDL_mouse.c Tue Sep 15 07:54:17 2020 +0300 +@@ -642,8 +642,8 @@ + event.wheel.preciseX = x; + event.wheel.preciseY = y; + #endif +- event.wheel.x = integral_x; +- event.wheel.y = integral_y; ++ event.wheel.x = x; //integral_x; ++ event.wheel.y = y; //integral_y; + event.wheel.direction = (Uint32)direction; + posted = (SDL_PushEvent(&event) > 0); + } +diff -r 4f06c06b6d19 src/video/cocoa/SDL_cocoamouse.m +--- a/src/video/cocoa/SDL_cocoamouse.m Wed Aug 05 15:28:51 2020 +0200 ++++ b/src/video/cocoa/SDL_cocoamouse.m Tue Sep 15 07:54:17 2020 +0300 +@@ -424,8 +424,8 @@ + } + + SDL_MouseID mouseID = mouse->mouseID; +- CGFloat x = -[event deltaX]; +- CGFloat y = [event deltaY]; ++ CGFloat x = -[event scrollingDeltaX]; ++ CGFloat y = [event scrollingDeltaY]; + SDL_MouseWheelDirection direction = SDL_MOUSEWHEEL_NORMAL; + + if ([event respondsToSelector:@selector(isDirectionInvertedFromDevice)]) { -- cgit v1.2.3