Mercurial > sdl-ios-xcode
comparison src/events/SDL_mouse.c @ 2152:003c1b5b07da
Fixed bug #382
Added horizontal scrolling support
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 06 Jul 2007 09:22:18 +0000 |
parents | 5f6550e5184f |
children | 44e49d3fa6cf 64f346a83ed3 |
comparison
equal
deleted
inserted
replaced
2151:1e0692271600 | 2152:003c1b5b07da |
---|---|
425 } | 425 } |
426 return posted; | 426 return posted; |
427 } | 427 } |
428 | 428 |
429 int | 429 int |
430 SDL_SendMouseWheel(int index, int motion) | 430 SDL_SendMouseWheel(int index, int x, int y) |
431 { | 431 { |
432 SDL_Mouse *mouse = SDL_GetMouse(index); | 432 SDL_Mouse *mouse = SDL_GetMouse(index); |
433 int posted; | 433 int posted; |
434 | 434 |
435 if (!mouse || !motion) { | 435 if (!mouse || (!x && !y)) { |
436 return 0; | 436 return 0; |
437 } | 437 } |
438 | 438 |
439 /* Post the event, if desired */ | 439 /* Post the event, if desired */ |
440 posted = 0; | 440 posted = 0; |
441 if (SDL_ProcessEvents[SDL_MOUSEWHEEL] == SDL_ENABLE) { | 441 if (SDL_ProcessEvents[SDL_MOUSEWHEEL] == SDL_ENABLE) { |
442 SDL_Event event; | 442 SDL_Event event; |
443 event.type = SDL_MOUSEWHEEL; | 443 event.type = SDL_MOUSEWHEEL; |
444 event.wheel.which = (Uint8) index; | 444 event.wheel.which = (Uint8) index; |
445 event.wheel.motion = motion; | 445 event.wheel.x = x; |
446 event.wheel.y = y; | |
446 event.wheel.windowID = mouse->focus; | 447 event.wheel.windowID = mouse->focus; |
447 posted = (SDL_PushEvent(&event) > 0); | 448 posted = (SDL_PushEvent(&event) > 0); |
448 } | 449 } |
449 return posted; | 450 return posted; |
450 } | 451 } |