Commit 40bb8b5a authored by Sam Lantinga's avatar Sam Lantinga

Applied John Popplewell's fix for left-handed mice under Windows.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40492
parent 92d0c77b
...@@ -58,6 +58,7 @@ static void (*SDL_DIfun[MAX_INPUTS])(const int, DIDEVICEOBJECTDATA *); ...@@ -58,6 +58,7 @@ static void (*SDL_DIfun[MAX_INPUTS])(const int, DIDEVICEOBJECTDATA *);
static int SDL_DIndev = 0; static int SDL_DIndev = 0;
static int mouse_lost; static int mouse_lost;
static int mouse_pressed; static int mouse_pressed;
static int mouse_buttons_swapped = 0;
/* The translation table from a DirectInput scancode to an SDL keysym */ /* The translation table from a DirectInput scancode to an SDL keysym */
static SDLKey DIK_keymap[256]; static SDLKey DIK_keymap[256];
...@@ -216,6 +217,7 @@ static int DX5_DInputInit(_THIS) ...@@ -216,6 +217,7 @@ static int DX5_DInputInit(_THIS)
++SDL_DIndev; ++SDL_DIndev;
} }
mouse_pressed = 0; mouse_pressed = 0;
mouse_buttons_swapped = GetSystemMetrics(SM_SWAPBUTTON);
/* DirectInput is ready! */ /* DirectInput is ready! */
return(0); return(0);
...@@ -340,6 +342,11 @@ static void handle_mouse(const int numevents, DIDEVICEOBJECTDATA *ptrbuf) ...@@ -340,6 +342,11 @@ static void handle_mouse(const int numevents, DIDEVICEOBJECTDATA *ptrbuf)
} }
state = SDL_RELEASED; state = SDL_RELEASED;
} }
if ( mouse_buttons_swapped ) {
if ( button == 1 ) button = 3;
else
if ( button == 3 ) button = 1;
}
posted = SDL_PrivateMouseButton(state, button, posted = SDL_PrivateMouseButton(state, button,
0, 0); 0, 0);
} }
...@@ -411,6 +418,11 @@ static void handle_mouse(const int numevents, DIDEVICEOBJECTDATA *ptrbuf) ...@@ -411,6 +418,11 @@ static void handle_mouse(const int numevents, DIDEVICEOBJECTDATA *ptrbuf)
} }
state = SDL_RELEASED; state = SDL_RELEASED;
} }
if ( mouse_buttons_swapped ) {
if ( button == 1 ) button = 3;
else
if ( button == 3 ) button = 1;
}
posted = SDL_PrivateMouseButton(state, button, posted = SDL_PrivateMouseButton(state, button,
0, 0); 0, 0);
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment