Skip to content

Commit

Permalink
Applied John Popplewell's fix for left-handed mice under Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Sep 16, 2002
1 parent a89ceb1 commit a2ea6c7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/video/windx5/SDL_dx5events.c
Expand Up @@ -58,6 +58,7 @@ static void (*SDL_DIfun[MAX_INPUTS])(const int, DIDEVICEOBJECTDATA *);
static int SDL_DIndev = 0;
static int mouse_lost;
static int mouse_pressed;
static int mouse_buttons_swapped = 0;

/* The translation table from a DirectInput scancode to an SDL keysym */
static SDLKey DIK_keymap[256];
Expand Down Expand Up @@ -216,6 +217,7 @@ static int DX5_DInputInit(_THIS)
++SDL_DIndev;
}
mouse_pressed = 0;
mouse_buttons_swapped = GetSystemMetrics(SM_SWAPBUTTON);

/* DirectInput is ready! */
return(0);
Expand Down Expand Up @@ -340,6 +342,11 @@ static void handle_mouse(const int numevents, DIDEVICEOBJECTDATA *ptrbuf)
}
state = SDL_RELEASED;
}
if ( mouse_buttons_swapped ) {
if ( button == 1 ) button = 3;
else
if ( button == 3 ) button = 1;
}
posted = SDL_PrivateMouseButton(state, button,
0, 0);
}
Expand Down Expand Up @@ -411,6 +418,11 @@ static void handle_mouse(const int numevents, DIDEVICEOBJECTDATA *ptrbuf)
}
state = SDL_RELEASED;
}
if ( mouse_buttons_swapped ) {
if ( button == 1 ) button = 3;
else
if ( button == 3 ) button = 1;
}
posted = SDL_PrivateMouseButton(state, button,
0, 0);
break;
Expand Down

0 comments on commit a2ea6c7

Please sign in to comment.