Skip to content

Commit

Permalink
Reverted mousewheel support in 1.2, since it breaks binary compatibil…
Browse files Browse the repository at this point in the history
…ity.
  • Loading branch information
slouken committed Jul 6, 2007
1 parent e19f070 commit 371e338
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 46 deletions.
2 changes: 0 additions & 2 deletions WhatsNew
Expand Up @@ -7,8 +7,6 @@ Version 1.0:
Added SDL_VIDEO_ALLOW_SCREENSAVER to override SDL's disabling
of the screensaver on Mac OS X and X11.

Added SDL_BUTTON_WHEELLEFT (6) and SDL_BUTTON_WHEELRIGHT (7)

1.2.10:
If SDL_OpenAudio() is passed zero for the desired format
fields, the following environment variables will be used
Expand Down
3 changes: 0 additions & 3 deletions docs.html
Expand Up @@ -28,9 +28,6 @@ <H3> General Notes </H3>
<P>
Added SDL_VIDEO_ALLOW_SCREENSAVER to override SDL's disabling of the screensaver on Mac OS X, Windows, and X11.
</P>
<P>
Added SDL_BUTTON_WHEELLEFT (6) and SDL_BUTTON_WHEELRIGHT (7)
</P>
<P>
Fixed buffer overrun crash when resampling audio rates.
</P>
Expand Down
4 changes: 0 additions & 4 deletions include/SDL_mouse.h
Expand Up @@ -115,17 +115,13 @@ extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
Button 3: Right mouse button
Button 4: Mouse wheel up (may also be a real button)
Button 5: Mouse wheel down (may also be a real button)
Button 6: Mouse wheel left (may also be a real button)
Button 7: Mouse wheel right (may also be a real button)
*/
#define SDL_BUTTON(X) (1 << ((X)-1))
#define SDL_BUTTON_LEFT 1
#define SDL_BUTTON_MIDDLE 2
#define SDL_BUTTON_RIGHT 3
#define SDL_BUTTON_WHEELUP 4
#define SDL_BUTTON_WHEELDOWN 5
#define SDL_BUTTON_WHEELLEFT 6
#define SDL_BUTTON_WHEELRIGHT 7
#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT)
#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE)
#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT)
Expand Down
23 changes: 6 additions & 17 deletions src/video/bwindow/SDL_sysevents.cc
Expand Up @@ -294,23 +294,12 @@ SDL_WarpMouse((int)center.x*2-1,(int)center.y*2-1);
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 ( 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);
}
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);
}
}
break;
Expand Down
25 changes: 7 additions & 18 deletions src/video/quartz/SDL_QuartzEvents.m
Expand Up @@ -932,24 +932,13 @@ disassociated from the mouse (and therefore
Uint8 button;
dy = [ event deltaY ];
dx = [ event deltaX ];
if ( dy ) {
if ( dy > 0.0 ) /* Scroll up */
button = SDL_BUTTON_WHEELUP;
else /* Scroll down */
button = SDL_BUTTON_WHEELDOWN;
/* For now, wheel is sent as a quick down+up */
SDL_PrivateMouseButton (SDL_PRESSED, button, 0, 0);
SDL_PrivateMouseButton (SDL_RELEASED, button, 0, 0);
}
if ( dx ) {
if ( dx > 0.0 ) /* Scroll left */
button = SDL_BUTTON_WHEELLEFT;
else /* Scroll right */
button = SDL_BUTTON_WHEELRIGHT;
/* For now, wheel is sent as a quick down+up */
SDL_PrivateMouseButton (SDL_PRESSED, button, 0, 0);
SDL_PrivateMouseButton (SDL_RELEASED, button, 0, 0);
}
if ( dy > 0.0 || dx > 0.0 ) /* Scroll up */
button = SDL_BUTTON_WHEELUP;
else /* Scroll down */
button = SDL_BUTTON_WHEELDOWN;
/* For now, wheel is sent as a quick down+up */
SDL_PrivateMouseButton (SDL_PRESSED, button, 0, 0);
SDL_PrivateMouseButton (SDL_RELEASED, button, 0, 0);
}
break;
case NSKeyUp:
Expand Down
4 changes: 2 additions & 2 deletions src/video/wincommon/SDL_sysevents.c
Expand Up @@ -520,12 +520,12 @@ LRESULT CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
break;
case WM_XBUTTONDOWN:
xbuttonval = GET_XBUTTON_WPARAM(wParam);
button = SDL_BUTTON_WHEELRIGHT + xbuttonval;
button = SDL_BUTTON_WHEELDOWN + xbuttonval;
state = SDL_PRESSED;
break;
case WM_XBUTTONUP:
xbuttonval = GET_XBUTTON_WPARAM(wParam);
button = SDL_BUTTON_WHEELRIGHT + xbuttonval;
button = SDL_BUTTON_WHEELDOWN + xbuttonval;
state = SDL_RELEASED;
break;
default:
Expand Down

0 comments on commit 371e338

Please sign in to comment.