[patch from Kelvin Delbarre]

This fixes the mapping of SDL mouse-button numbers to MacOS/ADB mouse-button numbers,
to correct the reversal of the middle and right buttons. Most useful in conjunction
with a multi-button mouse enabler such as TheMouse2B:

http://hyperarchive.lcs.mit.edu/HyperArchive/Archive/cfg/themouse-2b-11.hqx

... which can turn a right-click into a control-click.
This commit is contained in:
asvitkine 2008-07-20 07:33:09 +00:00
parent bf7408e151
commit 6dcddb92e6

View File

@ -1770,8 +1770,12 @@ static void handle_events(void)
// Mouse button
case SDL_MOUSEBUTTONDOWN: {
unsigned int button = event.button.button;
if (button < 4)
ADBMouseDown(button - 1);
if (button == SDL_BUTTON_LEFT)
ADBMouseDown(0);
else if (button == SDL_BUTTON_RIGHT)
ADBMouseDown(1);
else if (button == SDL_BUTTON_MIDDLE)
ADBMouseDown(2);
else if (button < 6) { // Wheel mouse
if (mouse_wheel_mode == 0) {
int key = (button == 5) ? 0x79 : 0x74; // Page up/down
@ -1789,8 +1793,12 @@ static void handle_events(void)
}
case SDL_MOUSEBUTTONUP: {
unsigned int button = event.button.button;
if (button < 4)
ADBMouseUp(button - 1);
if (button == SDL_BUTTON_LEFT)
ADBMouseUp(0);
else if (button == SDL_BUTTON_RIGHT)
ADBMouseUp(1);
else if (button == SDL_BUTTON_MIDDLE)
ADBMouseUp(2);
break;
}