Oskar Linde fixed bug #507 SDL-1.2
authorSam Lantinga <slouken@libsdl.org>
Fri, 28 Dec 2007 08:11:26 +0000
branchSDL-1.2
changeset 4101 ab38230546a5
parent 4100 ad8bdb215737
child 4102 328a3f973890
Oskar Linde fixed bug #507 Trackpad scrolling on OSX is broken. Scrolling up/slightly right gets translated into a Down event in SDL. The following patch fixes this extremely irritating issue:
src/video/quartz/SDL_QuartzEvents.m
--- a/src/video/quartz/SDL_QuartzEvents.m	Fri Dec 28 08:06:36 2007 +0000
+++ b/src/video/quartz/SDL_QuartzEvents.m	Fri Dec 28 08:11:26 2007 +0000
@@ -930,10 +930,12 @@
                         Uint8 button;
                         dy = [ event deltaY ];
                         dx = [ event deltaX ];
-                        if ( dy > 0.0 || dx > 0.0 ) /* Scroll up */
+                        if ( dy > 0.0 ) /* Scroll up */
                             button = SDL_BUTTON_WHEELUP;
-                        else /* Scroll down */
+                        else if ( dy < 0.0 ) /* Scroll down */
                             button = SDL_BUTTON_WHEELDOWN;
+                        else
+                            break; /* Horizontal scroll */
                         /* For now, wheel is sent as a quick down+up */
                         SDL_PrivateMouseButton (SDL_PRESSED, button, 0, 0);
                         SDL_PrivateMouseButton (SDL_RELEASED, button, 0, 0);