diff src/SDL_compat.c @ 2153:760c1bd2d625

Reverted mousewheel support in 1.2, since it breaks binary compatibility.
author Sam Lantinga <slouken@libsdl.org>
date Fri, 06 Jul 2007 13:45:10 +0000
parents 003c1b5b07da
children 98e76ba7d5a4
line wrap: on
line diff
--- a/src/SDL_compat.c	Fri Jul 06 09:22:18 2007 +0000
+++ b/src/SDL_compat.c	Fri Jul 06 13:45:10 2007 +0000
@@ -252,46 +252,33 @@
             int selected;
             int x, y;
 
+            if (event->wheel.y == 0) {
+                break;
+            }
+
             selected = SDL_SelectMouse(event->wheel.which);
             SDL_GetMouseState(&x, &y);
             SDL_SelectMouse(selected);
 
+            if (event->wheel.y > 0) {
+                button = SDL_BUTTON_WHEELUP;
+            } else {
+                button = SDL_BUTTON_WHEELDOWN;
+            }
+
             fake.button.which = event->wheel.windowID;
+            fake.button.button = button;
             fake.button.x = x;
             fake.button.y = y;
             fake.button.windowID = event->wheel.windowID;
 
-            if (event->wheel.y) {
-                if (event->wheel.y > 0) {
-                    fake.button.button = SDL_BUTTON_WHEELUP;
-                } else {
-                    fake.button.button = SDL_BUTTON_WHEELDOWN;
-                }
-
-                fake.type = SDL_MOUSEBUTTONDOWN;
-                fake.button.state = SDL_PRESSED;
-                SDL_PushEvent(&fake);
+            fake.type = SDL_MOUSEBUTTONDOWN;
+            fake.button.state = SDL_PRESSED;
+            SDL_PushEvent(&fake);
 
-                fake.type = SDL_MOUSEBUTTONUP;
-                fake.button.state = SDL_RELEASED;
-                SDL_PushEvent(&fake);
-            }
-            if (event->wheel.x) {
-                if (event->wheel.y > 0) {
-                    fake.button.button = SDL_BUTTON_WHEELLEFT;
-                } else {
-                    fake.button.button = SDL_BUTTON_WHEELRIGHT;
-                }
-
-                fake.type = SDL_MOUSEBUTTONDOWN;
-                fake.button.state = SDL_PRESSED;
-                SDL_PushEvent(&fake);
-
-                fake.type = SDL_MOUSEBUTTONUP;
-                fake.button.state = SDL_RELEASED;
-                SDL_PushEvent(&fake);
-            }
-
+            fake.type = SDL_MOUSEBUTTONUP;
+            fake.button.state = SDL_RELEASED;
+            SDL_PushEvent(&fake);
             break;
         }