diff src/video/bwindow/SDL_sysevents.cc @ 4009:1146681dbb74 SDL-1.2

Fixed bug #382 Added horizontal scrolling support: SDL_BUTTON_WHEELLEFT (6) and SDL_BUTTON_WHEELRIGHT (7)
author Sam Lantinga <slouken@libsdl.org>
date Fri, 06 Jul 2007 09:15:43 +0000
parents 678576473849
children f5794774970d
line wrap: on
line diff
--- a/src/video/bwindow/SDL_sysevents.cc	Fri Jul 06 07:45:33 2007 +0000
+++ b/src/video/bwindow/SDL_sysevents.cc	Fri Jul 06 09:15:43 2007 +0000
@@ -294,12 +294,23 @@
 			float x, y;
 			x = y = 0;
 			if (msg->FindFloat("be:wheel_delta_x", &x) == B_OK && msg->FindFloat("be:wheel_delta_y", &y) == B_OK) {
-				if (x < 0 || y < 0) {
-					SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_WHEELDOWN, 0, 0);
-					SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELDOWN, 0, 0);
-				} else if (x > 0 || y > 0) {
-					SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_WHEELUP, 0, 0);
-					SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELUP, 0, 0);
+				if ( y ) {
+					if (y < 0) {
+						SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_WHEELDOWN, 0, 0);
+						SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELDOWN, 0, 0);
+					} else {
+						SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_WHEELUP, 0, 0);
+						SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELUP, 0, 0);
+					}
+				}
+				if ( x ) {
+					if (x < 0) {
+						SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_WHEELRIGHT, 0, 0);
+						SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELRIGHT, 0, 0);
+					} else {
+						SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_WHEELLEFT, 0, 0);
+						SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELLEFT, 0, 0);
+					}
 				}
 			}
 			break;