Fix MOUSE4/MOUSE5

MOUSE6-8 will not be supported on SDL2 as there is no interface for them.
This commit is contained in:
Ronald Kinard 2014-11-13 15:31:32 -06:00
parent 80891e916d
commit 5d0eafb26a

View file

@ -424,226 +424,6 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Scancode code)
return 0;
}
//
// Translates the SDL scancode into SRB2 key
//
// Deprecated: keycodes in SDL2 are not scancode based.
// They do not work with non-US keyboards anymore.
//
static INT32 SDLatekey(SDL_Keycode sym)
{
INT32 rc = sym + 0x80;
switch (sym)
{
case SDLK_LEFT:
rc = KEY_LEFTARROW;
break;
case SDLK_RIGHT:
rc = KEY_RIGHTARROW;
break;
case SDLK_DOWN:
rc = KEY_DOWNARROW;
break;
case SDLK_UP:
rc = KEY_UPARROW;
break;
case SDLK_ESCAPE:
rc = KEY_ESCAPE;
break;
case SDLK_SPACE:
rc = KEY_SPACE;
break;
case SDLK_RETURN:
case SDLK_KP_ENTER:
rc = KEY_ENTER;
break;
case SDLK_TAB:
rc = KEY_TAB;
break;
case SDLK_F1:
rc = KEY_F1;
break;
case SDLK_F2:
rc = KEY_F2;
break;
case SDLK_F3:
rc = KEY_F3;
break;
case SDLK_F4:
rc = KEY_F4;
break;
case SDLK_F5:
rc = KEY_F5;
break;
case SDLK_F6:
rc = KEY_F6;
break;
case SDLK_F7:
rc = KEY_F7;
break;
case SDLK_F8:
rc = KEY_F8;
break;
case SDLK_F9:
rc = KEY_F9;
break;
case SDLK_F10:
rc = KEY_F10;
break;
case SDLK_F11:
rc = KEY_F11;
break;
case SDLK_F12:
rc = KEY_F12;
break;
case SDLK_BACKSPACE:
rc = KEY_BACKSPACE;
break;
case SDLK_DELETE:
rc = KEY_DEL;
break;
case SDLK_KP_EQUALS: //Alam & Logan: WTF? Mac KB haves one! XD
case SDLK_PAUSE:
rc = KEY_PAUSE;
break;
case SDLK_EQUALS:
case SDLK_PLUS:
rc = KEY_EQUALS;
break;
case SDLK_MINUS:
rc = KEY_MINUS;
break;
case SDLK_LSHIFT:
rc = KEY_LSHIFT;
break;
case SDLK_RSHIFT:
rc = KEY_RSHIFT;
break;
case SDLK_CAPSLOCK:
rc = KEY_CAPSLOCK;
break;
case SDLK_LCTRL:
rc = KEY_LCTRL;
break;
case SDLK_RCTRL:
rc = KEY_RCTRL;
break;
case SDLK_LALT:
rc = KEY_LALT;
break;
case SDLK_RALT:
rc = KEY_RALT;
break;
case SDLK_NUMLOCKCLEAR:
rc = KEY_NUMLOCK;
break;
case SDLK_SCROLLLOCK:
rc = KEY_SCROLLLOCK;
break;
case SDLK_PAGEUP:
rc = KEY_PGUP;
break;
case SDLK_PAGEDOWN:
rc = KEY_PGDN;
break;
case SDLK_END:
rc = KEY_END;
break;
case SDLK_HOME:
rc = KEY_HOME;
break;
case SDLK_INSERT:
rc = KEY_INS;
break;
case SDLK_KP_0:
rc = KEY_KEYPAD0;
break;
case SDLK_KP_1:
rc = KEY_KEYPAD1;
break;
case SDLK_KP_2:
rc = KEY_KEYPAD2;
break;
case SDLK_KP_3:
rc = KEY_KEYPAD3;
break;
case SDLK_KP_4:
rc = KEY_KEYPAD4;
break;
case SDLK_KP_5:
rc = KEY_KEYPAD5;
break;
case SDLK_KP_6:
rc = KEY_KEYPAD6;
break;
case SDLK_KP_7:
rc = KEY_KEYPAD7;
break;
case SDLK_KP_8:
rc = KEY_KEYPAD8;
break;
case SDLK_KP_9:
rc = KEY_KEYPAD9;
break;
case SDLK_KP_PERIOD:
rc = KEY_KPADDEL;
break;
case SDLK_KP_DIVIDE:
rc = KEY_KPADSLASH;
break;
case SDLK_KP_MULTIPLY:
rc = '*';
break;
case SDLK_KP_MINUS:
rc = KEY_MINUSPAD;
break;
case SDLK_KP_PLUS:
rc = KEY_PLUSPAD;
break;
case SDLK_LMETA:
rc = KEY_LEFTWIN;
break;
case SDLK_RMETA:
rc = KEY_RIGHTWIN;
break;
case SDLK_MENU:
rc = KEY_MENU;
break;
default:
if (sym >= SDLK_SPACE && sym <= SDLK_DELETE)
rc = sym - SDLK_SPACE + ' ';
else if (sym >= 'A' && sym <= 'Z')
rc = sym - 'A' + 'a';
else if (sym)
{
I_OutputMsg("Unknown Keycode %i, Name: %s\n",sym, SDL_GetKeyName( sym ));
}
else if (!sym) rc = 0;
break;
}
return rc;
}
static void SDLdoUngrabMouse(void)
{
SDL_SetWindowGrab(window, SDL_FALSE);
@ -1020,9 +800,11 @@ static void Impl_HandleMouseButtonEvent(SDL_MouseButtonEvent evt, Uint32 type)
else if (evt.button == SDL_BUTTON_RIGHT)
event.data1 = KEY_MOUSE1+1;
else if (evt.button == SDL_BUTTON_LEFT)
event.data1= KEY_MOUSE1;
else if (evt.button <= MOUSEBUTTONS)
event.data1 = KEY_MOUSE1 + evt.which - SDL_BUTTON_LEFT;
event.data1 = KEY_MOUSE1;
else if (evt.button == SDL_BUTTON_X1)
event.data1 = KEY_MOUSE1+3;
else if (evt.button == SDL_BUTTON_X2)
event.data1 = KEY_MOUSE1+4;
if (event.type == ev_keyup || event.type == ev_keydown)
{
D_PostEvent(&event);