Added support for mapping keys to ctrl, alt, shift, or combinations thereof (though ctrl+alt will never trigger for some reason)

svn-id: r43398
This commit is contained in:
Jody Northup 2009-08-15 09:12:36 +00:00
parent 6ede831093
commit 8d051e24fe
3 changed files with 9 additions and 8 deletions

View File

@ -195,12 +195,13 @@ bool Keymapper::mapKey(const KeyState& key, bool keyDown) {
// HACK: Temporary fix for modifier recognition, get the hwkey's keystate
// to correct for keydown and keyup generating different ascii codes in SDL
// to be solved more permanently by using a structure other than KeyState
const HardwareKey *hwkey = findHardwareKey(key);
if (!hwkey)
return false;
KeyState k = hwkey->key;
k.flags = key.flags;
k.flags = key.flags & hwkey->modMask;
// Search for key in active keymap stack
for (int i = _activeMaps.size() - 1; i >= 0; --i) {

View File

@ -43,7 +43,7 @@ enum KeyType {
kTriggerRightKeyType,
kStartKeyType,
kSelectKeyType,
// kModiferKeyType,
kModiferKeyType,
/* ... */
kKeyTypeMax

View File

@ -163,12 +163,12 @@ static const Key keys[] = {
// 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},
// {"LCTRL", KEYCODE_LCTRL, 0, "Left Ctrl", kModiferKeyType, ~KBD_CTRL},
// {"RALT", KEYCODE_RALT, 0, "Right Alt", kModiferKeyType, ~KBD_ALT},
// {"LALT", KEYCODE_LALT, 0, "Left Alt", kModiferKeyType, ~KBD_ALT},
{"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},
{"LCTRL", KEYCODE_LCTRL, 0, "Left Ctrl", kModiferKeyType, ~KBD_CTRL},
{"RALT", KEYCODE_RALT, 0, "Right Alt", kModiferKeyType, ~KBD_ALT},
{"LALT", KEYCODE_LALT, 0, "Left Alt", kModiferKeyType, ~KBD_ALT},
// Miscellaneous function keys