comparison 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
comparison
equal deleted inserted replaced
4008:a19fd8bcdd52 4009:1146681dbb74
292 case B_MOUSE_WHEEL_CHANGED: 292 case B_MOUSE_WHEEL_CHANGED:
293 { 293 {
294 float x, y; 294 float x, y;
295 x = y = 0; 295 x = y = 0;
296 if (msg->FindFloat("be:wheel_delta_x", &x) == B_OK && msg->FindFloat("be:wheel_delta_y", &y) == B_OK) { 296 if (msg->FindFloat("be:wheel_delta_x", &x) == B_OK && msg->FindFloat("be:wheel_delta_y", &y) == B_OK) {
297 if (x < 0 || y < 0) { 297 if ( y ) {
298 SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_WHEELDOWN, 0, 0); 298 if (y < 0) {
299 SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELDOWN, 0, 0); 299 SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_WHEELDOWN, 0, 0);
300 } else if (x > 0 || y > 0) { 300 SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELDOWN, 0, 0);
301 SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_WHEELUP, 0, 0); 301 } else {
302 SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELUP, 0, 0); 302 SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_WHEELUP, 0, 0);
303 SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELUP, 0, 0);
304 }
305 }
306 if ( x ) {
307 if (x < 0) {
308 SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_WHEELRIGHT, 0, 0);
309 SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELRIGHT, 0, 0);
310 } else {
311 SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_WHEELLEFT, 0, 0);
312 SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELLEFT, 0, 0);
313 }
303 } 314 }
304 } 315 }
305 break; 316 break;
306 } 317 }
307 318