src/SDL_compat.c
changeset 2153 760c1bd2d625
parent 2152 003c1b5b07da
child 2202 98e76ba7d5a4
--- 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;
         }