aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/sdl
diff options
context:
space:
mode:
authorJody Northup2009-08-15 08:48:13 +0000
committerJody Northup2009-08-15 08:48:13 +0000
commit7ea0646a49a848d2cfa1f18162dba66fc6ddef0b (patch)
treeac3306dff4f17d7600b3390b28d08e1f958302a3 /backends/platform/sdl
parent44e79803648ba7704e97031752506ad42176990d (diff)
downloadscummvm-rg350-7ea0646a49a848d2cfa1f18162dba66fc6ddef0b.tar.gz
scummvm-rg350-7ea0646a49a848d2cfa1f18162dba66fc6ddef0b.tar.bz2
scummvm-rg350-7ea0646a49a848d2cfa1f18162dba66fc6ddef0b.zip
Removed excessive modifier definitions, prevented excessive memory consumption if getHardwareKeyset is called multiple times.
svn-id: r43395
Diffstat (limited to 'backends/platform/sdl')
-rw-r--r--backends/platform/sdl/hardwarekeys.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/backends/platform/sdl/hardwarekeys.cpp b/backends/platform/sdl/hardwarekeys.cpp
index c063ea5bff..623e8b50cf 100644
--- a/backends/platform/sdl/hardwarekeys.cpp
+++ b/backends/platform/sdl/hardwarekeys.cpp
@@ -162,7 +162,7 @@ static const Key keys[] = {
{"F15", KEYCODE_F15, 0, "F15", kActionKeyType, ~0},
-// // Modifier keys pressed alone
+ // Modifier keys pressed alone
// {"RSHIFT", KEYCODE_RSHIFT, 0, "Right Shift", kModiferKeyType, ~KBD_SHIFT},
// {"LSHIFT", KEYCODE_LSHIFT, 0, "Left Shift", kModiferKeyType, ~KBD_SHIFT},
// {"RCTRL", KEYCODE_RCTRL, 0, "Right Ctrl", kModiferKeyType, ~KBD_CTRL},
@@ -197,9 +197,6 @@ static const Mod modifiers[] = {
{ KBD_CTRL, "C+", "Ctrl+" },
{ KBD_ALT, "A+", "Alt+" },
{ KBD_SHIFT, "S+", "Shift+" },
- { KBD_CTRL | KBD_ALT, "C+A+", "Ctrl+Alt+" },
- { KBD_SHIFT | KBD_CTRL, "S+C+", "Shift+Ctrl+" },
- { KBD_SHIFT | KBD_CTRL | KBD_ALT, "S+C+A+", "Shift+Ctrl+Alt+" },
{ 0, 0, 0 }
};
#endif
@@ -207,7 +204,11 @@ static const Mod modifiers[] = {
Common::HardwareKeySet *OSystem_SDL::getHardwareKeySet() {
#ifdef ENABLE_KEYMAPPER
- HardwareKeySet *keySet = new HardwareKeySet();
+ static HardwareKeySet *keySet = new HardwareKeySet();
+ static bool keySetInited = false;
+ if (keySet && keySetInited)
+ return keySet;
+
const Key *key;
const Mod *mod;
char fullKeyId[50];
@@ -226,9 +227,11 @@ Common::HardwareKeySet *OSystem_SDL::getHardwareKeySet() {
snprintf(fullKeyId, 50, "%s", key->hwId);
snprintf(fullKeyDesc, 100, "%s", key->desc);
- keySet->addHardwareKey(new HardwareKey(fullKeyId, KeyState(key->keycode, ascii, 0), fullKeyDesc, key->preferredAction));
+ keySet->addHardwareKey(new HardwareKey(fullKeyId, KeyState(key->keycode, ascii, 0), fullKeyDesc, key->modableMask, key->preferredAction));
}
+ keySetInited = true;
+
return keySet;
#else