From ee8f1384e013d8da0636179a31c0e63162e6961b Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Tue, 9 Jul 2013 14:41:56 -0500 Subject: SDL Mouse Button clean up Make 'b' variable an int so that key values more than 255 will work (not currently an issue in ioq3 afaik). Use SDL_BUTTON_* for easier transition to SDL2. (SDL2 doesn't have SDL_BUTTON_WHEELUP or SDL_BUTTON_WHEELDOWN, X1/X2 are different values.) --- src/sdl/sdl_input.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/sdl/sdl_input.c b/src/sdl/sdl_input.c index 82bb4dfc..070ba600 100644 --- a/src/sdl/sdl_input.c +++ b/src/sdl/sdl_input.c @@ -961,17 +961,17 @@ static void IN_ProcessEvents( void ) case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: { - unsigned char b; + int b; switch( e.button.button ) { - case 1: b = K_MOUSE1; break; - case 2: b = K_MOUSE3; break; - case 3: b = K_MOUSE2; break; - case 4: b = K_MWHEELUP; break; - case 5: b = K_MWHEELDOWN; break; - case 6: b = K_MOUSE4; break; - case 7: b = K_MOUSE5; break; - default: b = K_AUX1 + ( e.button.button - 8 ) % 16; break; + case SDL_BUTTON_LEFT: b = K_MOUSE1; break; + case SDL_BUTTON_MIDDLE: b = K_MOUSE3; break; + case SDL_BUTTON_RIGHT: b = K_MOUSE2; break; + case SDL_BUTTON_WHEELUP: b = K_MWHEELUP; break; + case SDL_BUTTON_WHEELDOWN: b = K_MWHEELDOWN; break; + case SDL_BUTTON_X1: b = K_MOUSE4; break; + case SDL_BUTTON_X2: b = K_MOUSE5; break; + default: b = K_AUX1 + ( e.button.button - SDL_BUTTON_X2 + 1 ) % 16; break; } Com_QueueEvent( 0, SE_KEY, b, ( e.type == SDL_MOUSEBUTTONDOWN ? qtrue : qfalse ), 0, NULL ); -- cgit