--- a/QTfrontend/sdlkeys.cpp Wed May 01 00:29:46 2019 +0300
+++ b/QTfrontend/sdlkeys.cpp Wed May 01 00:13:23 2019 +0200
@@ -22,6 +22,7 @@
char sdlkeys[1024][2][128] =
{
+ // Mouse
{"mousel", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: Left button")},
{"mousem", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: Middle button")},
{"mouser", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: Right button")},
@@ -29,6 +30,8 @@
{"mousex2", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: X2 button")},
{"wheelup", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: Wheel up")},
{"wheeldown", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: Wheel down")},
+
+ // Keyboard
{"backspace", QT_TRANSLATE_NOOP("binds (keys)", "Backspace")},
{"tab", QT_TRANSLATE_NOOP("binds (keys)", "Tab")},
{"clear", QT_TRANSLATE_NOOP("binds (keys)", "Clear")},
@@ -83,7 +86,6 @@
{"x", "X"},
{"y", "Y"},
{"z", "Z"},
- {"delete", QT_TRANSLATE_NOOP("binds (keys)", "Delete")},
{"keypad_0", QT_TRANSLATE_NOOP("binds (keys)", "Keypad 0")},
{"keypad_1", QT_TRANSLATE_NOOP("binds (keys)", "Keypad 1")},
{"keypad_2", QT_TRANSLATE_NOOP("binds (keys)", "Keypad 2")},
@@ -105,6 +107,7 @@
{"right", QT_TRANSLATE_NOOP("binds (keys)", "Right")},
{"left", QT_TRANSLATE_NOOP("binds (keys)", "Left")},
{"insert", QT_TRANSLATE_NOOP("binds (keys)", "Insert")},
+ {"delete", QT_TRANSLATE_NOOP("binds (keys)", "Delete")},
{"home", QT_TRANSLATE_NOOP("binds (keys)", "Home")},
{"end", QT_TRANSLATE_NOOP("binds (keys)", "End")},
{"pageup", QT_TRANSLATE_NOOP("binds (keys)", "PageUp")},
@@ -139,6 +142,9 @@
{"left_gui", QT_TRANSLATE_NOOP("binds (keys)", "Left GUI")}
};
+// helper list for sdlkeys. true for keyboard keys, false for other
+bool sdlkeys_iskeyboard[1024];
+
// button name definitions for Microsoft's XBox360 controller
// don't modify button order!
char xb360buttons[10][128] =
--- a/QTfrontend/util/SDLInteraction.cpp Wed May 01 00:29:46 2019 +0300
+++ b/QTfrontend/util/SDLInteraction.cpp Wed May 01 00:13:23 2019 +0200
@@ -50,14 +50,25 @@
m_musicTrack = "";
m_isPlayingMusic = false;
lastchannel = 0;
+ int i;
+ // Initialize sdlkeys_iskeyboard
+ for (i=0; i<1024; i++) {
+ // First 7 entries are mouse buttons (see sdlkeys.cpp)
+ if ((i > 6) && (sdlkeys[i][0][0] != '\0'))
+ sdlkeys_iskeyboard[i] = true;
+ else
+ sdlkeys_iskeyboard[i] = false;
+ }
+
if(SDL_NumJoysticks())
addGameControllerKeys();
- int i = 0;
+ // Add special "none" key at the end of list
+ i = 0;
while(i < 1024 && sdlkeys[i][1][0] != '\0')
i++;
sprintf(sdlkeys[i][0], "none");
- sprintf(sdlkeys[i++][1], "%s", HWApplication::translate("binds (keys)", unboundcontrol).toUtf8().constData());
+ sprintf(sdlkeys[i][1], "%s", HWApplication::translate("binds (keys)", unboundcontrol).toUtf8().constData());
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);