aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/keymapper/hardware-key.h40
-rw-r--r--backends/keymapper/types.h1
-rw-r--r--backends/platform/sdl/hardwarekeys.cpp302
-rw-r--r--gui/GuiManager.cpp26
4 files changed, 207 insertions, 162 deletions
diff --git a/backends/keymapper/hardware-key.h b/backends/keymapper/hardware-key.h
index 8ddeada51e..c8c1d3c145 100644
--- a/backends/keymapper/hardware-key.h
+++ b/backends/keymapper/hardware-key.h
@@ -64,6 +64,29 @@ struct HardwareKey {
}
};
+/**
+* Describes an available hardware modifier
+*/
+struct HardwareMod {
+ /** unique id used for saving/loading to config */
+ char hwModId[HWKEY_ID_SIZE];
+
+ /** Human readable description */
+ String description;
+
+ /**
+ * The modifier flags that are generated by the
+ * back-end when this modifier key is pressed.
+ */
+ byte modFlags;
+
+ HardwareMod(const char *i, byte mf, String desc = "")
+ : modFlags(mf), description(desc) {
+ assert(i);
+ strncpy(hwModId, i, HWKEY_ID_SIZE);
+ }
+};
+
/**
* Simple class to encapsulate a device's set of HardwareKeys.
@@ -80,6 +103,11 @@ public:
delete *it;
}
+ void addHardwareMod(HardwareMod *mod) {
+ checkForMod(mod);
+ _mods.push_back(mod);
+ }
+
void addHardwareKey(HardwareKey *key) {
checkForKey(key);
_keys.push_back(key);
@@ -127,7 +155,19 @@ private:
}
}
+ void checkForMod(HardwareMod *mod) {
+ List<const HardwareMod*>::iterator it;
+
+ for (it = _mods.begin(); it != _mods.end(); it++) {
+ if (strncmp((*it)->hwModId, mod->hwModId, HWKEY_ID_SIZE) == 0)
+ error("Error adding HardwareMod '%s' - id of %s already in use!", mod->description.c_str(), mod->hwModId);
+ else if ((*it)->modFlags == mod->modFlags)
+ error("Error adding HardwareMod '%s' - modFlags already in use!", mod->description.c_str());
+ }
+ }
+
List<const HardwareKey*> _keys;
+ List<const HardwareMod*> _mods;
};
diff --git a/backends/keymapper/types.h b/backends/keymapper/types.h
index 7ad4c0e538..004a90bfcd 100644
--- a/backends/keymapper/types.h
+++ b/backends/keymapper/types.h
@@ -43,6 +43,7 @@ enum KeyType {
kTriggerRightKeyType,
kStartKeyType,
kSelectKeyType,
+// kModiferKeyType,
/* ... */
kKeyTypeMax
diff --git a/backends/platform/sdl/hardwarekeys.cpp b/backends/platform/sdl/hardwarekeys.cpp
index 1a8124bbf3..bba48286f0 100644
--- a/backends/platform/sdl/hardwarekeys.cpp
+++ b/backends/platform/sdl/hardwarekeys.cpp
@@ -37,161 +37,170 @@ struct Key {
uint16 ascii;
const char *desc;
KeyType preferredAction;
- bool shiftable;
+ int32 modableMask;
};
static const Key keys[] = {
- {"BACKSPACE", KEYCODE_BACKSPACE, ASCII_BACKSPACE, "Backspace", kActionKeyType, false},
- {"TAB", KEYCODE_TAB, ASCII_TAB, "Tab", kActionKeyType, false},
- {"CLEAR", KEYCODE_CLEAR, 0, "Clear", kActionKeyType, false},
- {"RETURN", KEYCODE_RETURN, ASCII_RETURN, "Return", kActionKeyType, false},
- {"PAUSE", KEYCODE_PAUSE, 0, "Pause", kActionKeyType, false},
- {"ESCAPE", KEYCODE_ESCAPE, ASCII_ESCAPE, "Esc", kStartKeyType, false},
- {"SPACE", KEYCODE_SPACE, ASCII_SPACE, "Space", kActionKeyType, false},
- {"EXCLAIM", KEYCODE_EXCLAIM, '!', "!", kActionKeyType, false},
- {"QUOTEDBL", KEYCODE_QUOTEDBL, '"', "\"", kActionKeyType, false},
- {"HASH", KEYCODE_HASH, '#', "#", kActionKeyType, false},
- {"DOLLAR", KEYCODE_DOLLAR, '$', "$", kActionKeyType, false},
- {"AMPERSAND", KEYCODE_AMPERSAND, '&', "&", kActionKeyType, false},
- {"QUOTE", KEYCODE_QUOTE, '\'', "'", kActionKeyType, false},
- {"LEFTPAREN", KEYCODE_LEFTPAREN, '(', "(", kActionKeyType, false},
- {"RIGHTPAREN", KEYCODE_RIGHTPAREN, ')', ")", kActionKeyType, false},
- {"ASTERISK", KEYCODE_ASTERISK, '*', "*", kActionKeyType, false},
- {"PLUS", KEYCODE_PLUS, '+', "+", kActionKeyType, false},
- {"COMMA", KEYCODE_COMMA, ',', ",", kActionKeyType, false},
- {"MINUS", KEYCODE_MINUS, '-', "-", kActionKeyType, false},
- {"PERIOD", KEYCODE_PERIOD, '.', ".", kActionKeyType, false},
- {"SLASH", KEYCODE_SLASH, '/', "/", kActionKeyType, false},
- {"0", KEYCODE_0, '0', "0", kActionKeyType, false},
- {"1", KEYCODE_1, '1', "1", kActionKeyType, false},
- {"2", KEYCODE_2, '2', "2", kActionKeyType, false},
- {"3", KEYCODE_3, '3', "3", kActionKeyType, false},
- {"4", KEYCODE_4, '4', "4", kActionKeyType, false},
- {"5", KEYCODE_5, '5', "5", kActionKeyType, false},
- {"6", KEYCODE_6, '6', "6", kActionKeyType, false},
- {"7", KEYCODE_7, '7', "7", kActionKeyType, false},
- {"8", KEYCODE_8, '8', "8", kActionKeyType, false},
- {"9", KEYCODE_9, '9', "9", kActionKeyType, false},
- {"COLON", KEYCODE_COLON, ':', ":", kActionKeyType, false},
- {"SEMICOLON", KEYCODE_SEMICOLON, ';', ";", kActionKeyType, false},
- {"LESS", KEYCODE_LESS, '<', "<", kActionKeyType, false},
- {"EQUALS", KEYCODE_EQUALS, '=', "=", kActionKeyType, false},
- {"GREATER", KEYCODE_GREATER, '>', ">", kActionKeyType, false},
- {"QUESTION", KEYCODE_QUESTION, '?', "?", kActionKeyType, false},
- {"AT", KEYCODE_AT, '@', "@", kActionKeyType, false},
-
- {"LEFTBRACKET", KEYCODE_LEFTBRACKET, '[', "[", kActionKeyType, false},
- {"BACKSLASH", KEYCODE_BACKSLASH, '\\', "\\", kActionKeyType, false},
- {"RIGHTBRACKET", KEYCODE_RIGHTBRACKET, ']', "]", kActionKeyType, false},
- {"CARET", KEYCODE_CARET, '^', "^", kActionKeyType, false},
- {"UNDERSCORE", KEYCODE_UNDERSCORE, '_', "_", kActionKeyType, false},
- {"BACKQUOTE", KEYCODE_BACKQUOTE, '`', "`", kActionKeyType, false},
- {"a", KEYCODE_a, 'a', "a", kActionKeyType, true},
- {"b", KEYCODE_b, 'b', "b", kActionKeyType, true},
- {"c", KEYCODE_c, 'c', "c", kActionKeyType, true},
- {"d", KEYCODE_d, 'd', "d", kActionKeyType, true},
- {"e", KEYCODE_e, 'e', "e", kActionKeyType, true},
- {"f", KEYCODE_f, 'f', "f", kActionKeyType, true},
- {"g", KEYCODE_g, 'g', "g", kActionKeyType, true},
- {"h", KEYCODE_h, 'h', "h", kActionKeyType, true},
- {"i", KEYCODE_i, 'i', "i", kActionKeyType, true},
- {"j", KEYCODE_j, 'j', "j", kActionKeyType, true},
- {"k", KEYCODE_k, 'k', "k", kActionKeyType, true},
- {"l", KEYCODE_l, 'l', "l", kActionKeyType, true},
- {"m", KEYCODE_m, 'm', "m", kActionKeyType, true},
- {"n", KEYCODE_n, 'n', "n", kActionKeyType, true},
- {"o", KEYCODE_o, 'o', "o", kActionKeyType, true},
- {"p", KEYCODE_p, 'p', "p", kActionKeyType, true},
- {"q", KEYCODE_q, 'q', "q", kActionKeyType, true},
- {"r", KEYCODE_r, 'r', "r", kActionKeyType, true},
- {"s", KEYCODE_s, 's', "s", kActionKeyType, true},
- {"t", KEYCODE_t, 't', "t", kActionKeyType, true},
- {"u", KEYCODE_u, 'u', "u", kActionKeyType, true},
- {"v", KEYCODE_v, 'v', "v", kActionKeyType, true},
- {"w", KEYCODE_w, 'w', "w", kActionKeyType, true},
- {"x", KEYCODE_x, 'x', "x", kActionKeyType, true},
- {"y", KEYCODE_y, 'y', "y", kActionKeyType, true},
- {"z", KEYCODE_z, 'z', "z", kActionKeyType, true},
- {"DELETE", KEYCODE_DELETE, 0, "Del", kActionKeyType, false},
+ {"BACKSPACE", KEYCODE_BACKSPACE, ASCII_BACKSPACE, "Backspace", kActionKeyType, ~0},
+ {"TAB", KEYCODE_TAB, ASCII_TAB, "Tab", kActionKeyType, ~0},
+ {"CLEAR", KEYCODE_CLEAR, 0, "Clear", kActionKeyType, ~0},
+ {"RETURN", KEYCODE_RETURN, ASCII_RETURN, "Return", kActionKeyType, ~0},
+ {"PAUSE", KEYCODE_PAUSE, 0, "Pause", kActionKeyType, ~0},
+ {"ESCAPE", KEYCODE_ESCAPE, ASCII_ESCAPE, "Esc", kStartKeyType, ~0},
+ {"SPACE", KEYCODE_SPACE, ASCII_SPACE, "Space", kActionKeyType, ~0},
+ {"EXCLAIM", KEYCODE_EXCLAIM, '!', "!", kActionKeyType, ~0},
+ {"QUOTEDBL", KEYCODE_QUOTEDBL, '"', "\"", kActionKeyType, ~0},
+ {"HASH", KEYCODE_HASH, '#', "#", kActionKeyType, ~0},
+ {"DOLLAR", KEYCODE_DOLLAR, '$', "$", kActionKeyType, ~0},
+ {"AMPERSAND", KEYCODE_AMPERSAND, '&', "&", kActionKeyType, ~0},
+ {"QUOTE", KEYCODE_QUOTE, '\'', "'", kActionKeyType, ~0},
+ {"LEFTPAREN", KEYCODE_LEFTPAREN, '(', "(", kActionKeyType, ~0},
+ {"RIGHTPAREN", KEYCODE_RIGHTPAREN, ')', ")", kActionKeyType, ~0},
+ {"ASTERISK", KEYCODE_ASTERISK, '*', "*", kActionKeyType, ~0},
+ {"PLUS", KEYCODE_PLUS, '+', "+", kActionKeyType, ~0},
+ {"COMMA", KEYCODE_COMMA, ',', ",", kActionKeyType, ~0},
+ {"MINUS", KEYCODE_MINUS, '-', "-", kActionKeyType, ~0},
+ {"PERIOD", KEYCODE_PERIOD, '.', ".", kActionKeyType, ~0},
+ {"SLASH", KEYCODE_SLASH, '/', "/", kActionKeyType, ~0},
+ {"0", KEYCODE_0, '0', "0", kActionKeyType, ~0},
+ {"1", KEYCODE_1, '1', "1", kActionKeyType, ~0},
+ {"2", KEYCODE_2, '2', "2", kActionKeyType, ~0},
+ {"3", KEYCODE_3, '3', "3", kActionKeyType, ~0},
+ {"4", KEYCODE_4, '4', "4", kActionKeyType, ~0},
+ {"5", KEYCODE_5, '5', "5", kActionKeyType, ~0},
+ {"6", KEYCODE_6, '6', "6", kActionKeyType, ~0},
+ {"7", KEYCODE_7, '7', "7", kActionKeyType, ~0},
+ {"8", KEYCODE_8, '8', "8", kActionKeyType, ~0},
+ {"9", KEYCODE_9, '9', "9", kActionKeyType, ~0},
+ {"COLON", KEYCODE_COLON, ':', ":", kActionKeyType, ~0},
+ {"SEMICOLON", KEYCODE_SEMICOLON, ';', ";", kActionKeyType, ~0},
+ {"LESS", KEYCODE_LESS, '<', "<", kActionKeyType, ~0},
+ {"EQUALS", KEYCODE_EQUALS, '=', "=", kActionKeyType, ~0},
+ {"GREATER", KEYCODE_GREATER, '>', ">", kActionKeyType, ~0},
+ {"QUESTION", KEYCODE_QUESTION, '?', "?", kActionKeyType, ~0},
+ {"AT", KEYCODE_AT, '@', "@", kActionKeyType, ~0},
+
+ {"LEFTBRACKET", KEYCODE_LEFTBRACKET, '[', "[", kActionKeyType, ~0},
+ {"BACKSLASH", KEYCODE_BACKSLASH, '\\', "\\", kActionKeyType, ~0},
+ {"RIGHTBRACKET", KEYCODE_RIGHTBRACKET, ']', "]", kActionKeyType, ~0},
+ {"CARET", KEYCODE_CARET, '^', "^", kActionKeyType, ~0},
+ {"UNDERSCORE", KEYCODE_UNDERSCORE, '_', "_", kActionKeyType, ~0},
+ {"BACKQUOTE", KEYCODE_BACKQUOTE, '`', "`", kActionKeyType, ~0},
+ {"a", KEYCODE_a, 'A', "A", kActionKeyType, ~0},
+ {"b", KEYCODE_b, 'B', "B", kActionKeyType, ~0},
+ {"c", KEYCODE_c, 'C', "C", kActionKeyType, ~0},
+ {"d", KEYCODE_d, 'D', "D", kActionKeyType, ~0},
+ {"e", KEYCODE_e, 'E', "E", kActionKeyType, ~0},
+ {"f", KEYCODE_f, 'F', "F", kActionKeyType, ~0},
+ {"g", KEYCODE_g, 'G', "G", kActionKeyType, ~0},
+ {"h", KEYCODE_h, 'H', "H", kActionKeyType, ~0},
+ {"i", KEYCODE_i, 'I', "I", kActionKeyType, ~0},
+ {"j", KEYCODE_j, 'J', "J", kActionKeyType, ~0},
+ {"k", KEYCODE_k, 'K', "K", kActionKeyType, ~0},
+ {"l", KEYCODE_l, 'L', "L", kActionKeyType, ~0},
+ {"m", KEYCODE_m, 'M', "M", kActionKeyType, ~0},
+ {"n", KEYCODE_n, 'N', "N", kActionKeyType, ~0},
+ {"o", KEYCODE_o, 'O', "O", kActionKeyType, ~0},
+ {"p", KEYCODE_p, 'P', "P", kActionKeyType, ~0},
+ {"q", KEYCODE_q, 'Q', "Q", kActionKeyType, ~0},
+ {"r", KEYCODE_r, 'R', "R", kActionKeyType, ~0},
+ {"s", KEYCODE_s, 'S', "S", kActionKeyType, ~0},
+ {"t", KEYCODE_t, 'T', "T", kActionKeyType, ~0},
+ {"u", KEYCODE_u, 'U', "U", kActionKeyType, ~0},
+ {"v", KEYCODE_v, 'V', "V", kActionKeyType, ~0},
+ {"w", KEYCODE_w, 'W', "W", kActionKeyType, ~0},
+ {"x", KEYCODE_x, 'X', "X", kActionKeyType, ~0},
+ {"y", KEYCODE_y, 'Y', "Y", kActionKeyType, ~0},
+ {"z", KEYCODE_z, 'Z', "Z", kActionKeyType, ~0},
+ {"DELETE", KEYCODE_DELETE, 0, "Del", kActionKeyType, ~0},
// Numeric keypad
- {"KP0", KEYCODE_KP0, 0, "KP0", kActionKeyType, false},
- {"KP1", KEYCODE_KP1, 0, "KP1", kActionKeyType, false},
- {"KP2", KEYCODE_KP2, 0, "KP2", kActionKeyType, false},
- {"KP3", KEYCODE_KP3, 0, "KP3", kActionKeyType, false},
- {"KP4", KEYCODE_KP4, 0, "KP4", kActionKeyType, false},
- {"KP5", KEYCODE_KP5, 0, "KP5", kActionKeyType, false},
- {"KP6", KEYCODE_KP6, 0, "KP6", kActionKeyType, false},
- {"KP7", KEYCODE_KP7, 0, "KP7", kActionKeyType, false},
- {"KP8", KEYCODE_KP8, 0, "KP8", kActionKeyType, false},
- {"KP9", KEYCODE_KP9, 0, "KP9", kActionKeyType, false},
- {"KP_PERIOD", KEYCODE_KP_PERIOD, 0, "KP.", kActionKeyType, false},
- {"KP_DIVIDE", KEYCODE_KP_DIVIDE, 0, "KP/", kActionKeyType, false},
- {"KP_MULTIPLY", KEYCODE_KP_MULTIPLY, 0, "KP*", kActionKeyType, false},
- {"KP_MINUS", KEYCODE_KP_MINUS, 0, "KP-", kActionKeyType, false},
- {"KP_PLUS", KEYCODE_KP_PLUS, 0, "KP+", kActionKeyType, false},
- {"KP_ENTER", KEYCODE_KP_ENTER, 0, "KP Enter", kActionKeyType, false},
- {"KP_EQUALS", KEYCODE_KP_EQUALS, 0, "KP=", kActionKeyType, false},
+ {"KP0", KEYCODE_KP0, 0, "KP0", kActionKeyType, ~0},
+ {"KP1", KEYCODE_KP1, 0, "KP1", kActionKeyType, ~0},
+ {"KP2", KEYCODE_KP2, 0, "KP2", kActionKeyType, ~0},
+ {"KP3", KEYCODE_KP3, 0, "KP3", kActionKeyType, ~0},
+ {"KP4", KEYCODE_KP4, 0, "KP4", kActionKeyType, ~0},
+ {"KP5", KEYCODE_KP5, 0, "KP5", kActionKeyType, ~0},
+ {"KP6", KEYCODE_KP6, 0, "KP6", kActionKeyType, ~0},
+ {"KP7", KEYCODE_KP7, 0, "KP7", kActionKeyType, ~0},
+ {"KP8", KEYCODE_KP8, 0, "KP8", kActionKeyType, ~0},
+ {"KP9", KEYCODE_KP9, 0, "KP9", kActionKeyType, ~0},
+ {"KP_PERIOD", KEYCODE_KP_PERIOD, 0, "KP.", kActionKeyType, ~0},
+ {"KP_DIVIDE", KEYCODE_KP_DIVIDE, 0, "KP/", kActionKeyType, ~0},
+ {"KP_MULTIPLY", KEYCODE_KP_MULTIPLY, 0, "KP*", kActionKeyType, ~0},
+ {"KP_MINUS", KEYCODE_KP_MINUS, 0, "KP-", kActionKeyType, ~0},
+ {"KP_PLUS", KEYCODE_KP_PLUS, 0, "KP+", kActionKeyType, ~0},
+ {"KP_ENTER", KEYCODE_KP_ENTER, 0, "KP Enter", kActionKeyType, ~0},
+ {"KP_EQUALS", KEYCODE_KP_EQUALS, 0, "KP=", kActionKeyType, ~0},
// Arrows + Home/End pad
- {"UP", KEYCODE_UP, 0, "Up", kDirUpKeyType, false},
- {"DOWN", KEYCODE_DOWN, 0, "Down", kDirDownKeyType, false},
- {"RIGHT", KEYCODE_RIGHT, 0, "Right", kDirRightKeyType, false},
- {"LEFT", KEYCODE_LEFT, 0, "Left", kDirLeftKeyType, false},
- {"INSERT", KEYCODE_INSERT, 0, "Insert", kActionKeyType, false},
- {"HOME", KEYCODE_HOME, 0, "Home", kActionKeyType, false},
- {"END", KEYCODE_END, 0, "End", kActionKeyType, false},
- {"PAGEUP", KEYCODE_PAGEUP, 0, "PgUp", kActionKeyType, false},
- {"PAGEDOWN", KEYCODE_PAGEDOWN, 0, "PgDn", kActionKeyType, false},
+ {"UP", KEYCODE_UP, 0, "Up", kDirUpKeyType, ~0},
+ {"DOWN", KEYCODE_DOWN, 0, "Down", kDirDownKeyType, ~0},
+ {"RIGHT", KEYCODE_RIGHT, 0, "Right", kDirRightKeyType, ~0},
+ {"LEFT", KEYCODE_LEFT, 0, "Left", kDirLeftKeyType, ~0},
+ {"INSERT", KEYCODE_INSERT, 0, "Insert", kActionKeyType, ~0},
+ {"HOME", KEYCODE_HOME, 0, "Home", kActionKeyType, ~0},
+ {"END", KEYCODE_END, 0, "End", kActionKeyType, ~0},
+ {"PAGEUP", KEYCODE_PAGEUP, 0, "PgUp", kActionKeyType, ~0},
+ {"PAGEDOWN", KEYCODE_PAGEDOWN, 0, "PgDn", kActionKeyType, ~0},
// Function keys
- {"F1", KEYCODE_F1, ASCII_F1, "F1", kActionKeyType, false},
- {"F2", KEYCODE_F2, ASCII_F2, "F2", kActionKeyType, false},
- {"F3", KEYCODE_F3, ASCII_F3, "F3", kActionKeyType, false},
- {"F4", KEYCODE_F4, ASCII_F4, "F4", kActionKeyType, false},
- {"F5", KEYCODE_F5, ASCII_F5, "F5", kActionKeyType, false},
- {"F6", KEYCODE_F6, ASCII_F6, "F6", kActionKeyType, false},
- {"F7", KEYCODE_F7, ASCII_F7, "F7", kActionKeyType, false},
- {"F8", KEYCODE_F8, ASCII_F8, "F8", kActionKeyType, false},
- {"F9", KEYCODE_F9, ASCII_F9, "F9", kActionKeyType, false},
- {"F10", KEYCODE_F10, ASCII_F10, "F10", kActionKeyType, false},
- {"F11", KEYCODE_F11, ASCII_F11, "F11", kActionKeyType, false},
- {"F12", KEYCODE_F12, ASCII_F12, "F12", kActionKeyType, false},
- {"F13", KEYCODE_F13, 0, "F13", kActionKeyType, false},
- {"F14", KEYCODE_F14, 0, "F14", kActionKeyType, false},
- {"F15", KEYCODE_F15, 0, "F15", kActionKeyType, false},
+ {"F1", KEYCODE_F1, ASCII_F1, "F1", kActionKeyType, ~0},
+ {"F2", KEYCODE_F2, ASCII_F2, "F2", kActionKeyType, ~0},
+ {"F3", KEYCODE_F3, ASCII_F3, "F3", kActionKeyType, ~0},
+ {"F4", KEYCODE_F4, ASCII_F4, "F4", kActionKeyType, ~0},
+ {"F5", KEYCODE_F5, ASCII_F5, "F5", kActionKeyType, ~0},
+ {"F6", KEYCODE_F6, ASCII_F6, "F6", kActionKeyType, ~0},
+ {"F7", KEYCODE_F7, ASCII_F7, "F7", kActionKeyType, ~0},
+ {"F8", KEYCODE_F8, ASCII_F8, "F8", kActionKeyType, ~0},
+ {"F9", KEYCODE_F9, ASCII_F9, "F9", kActionKeyType, ~0},
+ {"F10", KEYCODE_F10, ASCII_F10, "F10", kActionKeyType, ~0},
+ {"F11", KEYCODE_F11, ASCII_F11, "F11", kActionKeyType, ~0},
+ {"F12", KEYCODE_F12, ASCII_F12, "F12", kActionKeyType, ~0},
+ {"F13", KEYCODE_F13, 0, "F13", kActionKeyType, ~0},
+ {"F14", KEYCODE_F14, 0, "F14", kActionKeyType, ~0},
+ {"F15", KEYCODE_F15, 0, "F15", kActionKeyType, ~0},
+
+
+// // 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},
+
// Miscellaneous function keys
- {"HELP", KEYCODE_HELP, 0, "Help", kActionKeyType, false},
- {"PRINT", KEYCODE_PRINT, 0, "Print", kActionKeyType, false},
- {"SYSREQ", KEYCODE_SYSREQ, 0, "SysRq", kActionKeyType, false},
- {"BREAK", KEYCODE_BREAK, 0, "Break", kActionKeyType, false},
- {"MENU", KEYCODE_MENU, 0, "Menu", kActionKeyType, false},
+ {"HELP", KEYCODE_HELP, 0, "Help", kActionKeyType, ~0},
+ {"PRINT", KEYCODE_PRINT, 0, "Print", kActionKeyType, ~0},
+ {"SYSREQ", KEYCODE_SYSREQ, 0, "SysRq", kActionKeyType, ~0},
+ {"BREAK", KEYCODE_BREAK, 0, "Break", kActionKeyType, ~0},
+ {"MENU", KEYCODE_MENU, 0, "Menu", kActionKeyType, ~0},
// Power Macintosh power key
- {"POWER", KEYCODE_POWER, 0, "Power", kActionKeyType, false},
+ {"POWER", KEYCODE_POWER, 0, "Power", kActionKeyType, ~0},
// Some european keyboards
- {"EURO", KEYCODE_EURO, 0, "Euro", kActionKeyType, false},
+ {"EURO", KEYCODE_EURO, 0, "Euro", kActionKeyType, ~0},
// Atari keyboard has Undo
- {"UNDO", KEYCODE_UNDO, 0, "Undo", kActionKeyType, false},
- {0, KEYCODE_INVALID, 0, 0, kGenericKeyType, false}
+ {"UNDO", KEYCODE_UNDO, 0, "Undo", kActionKeyType, ~0},
+ {0, KEYCODE_INVALID, 0, 0, kGenericKeyType, ~0}
};
struct Mod {
byte flag;
const char *id;
const char *desc;
- bool shiftable;
};
static const Mod modifiers[] = {
- { 0, "", "", false },
- { KBD_CTRL, "C+", "Ctrl+", false },
- { KBD_ALT, "A+", "Alt+", false },
- { KBD_SHIFT, "", "", true },
- { KBD_CTRL | KBD_ALT, "C+A+", "Ctrl+Alt+", false },
- { KBD_SHIFT | KBD_CTRL, "S+C+", "Shift+Ctrl+", true },
- { KBD_SHIFT | KBD_CTRL | KBD_ALT, "C+A+", "Ctrl+Alt+", true },
- { 0, 0, 0, false }
+ { 0, "", "" },
+ { 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
@@ -206,23 +215,18 @@ Common::HardwareKeySet *OSystem_SDL::getHardwareKeySet() {
uint16 ascii;
for (mod = modifiers; mod->id; mod++) {
- for (key = keys; key->hwId; key++) {
- ascii = key->ascii;
-
- if (mod->shiftable && key->shiftable) {
- snprintf(fullKeyId, 50, "%s%c", mod->id, toupper(key->hwId[0]));
- snprintf(fullKeyDesc, 100, "%s%c", mod->desc, toupper(key->desc[0]));
- ascii = toupper(key->ascii);
- } else if (mod->shiftable) {
- snprintf(fullKeyId, 50, "S+%s%s", mod->id, key->hwId);
- snprintf(fullKeyDesc, 100, "Shift+%s%s", mod->desc, key->desc);
- } else {
- snprintf(fullKeyId, 50, "%s%s", mod->id, key->hwId);
- snprintf(fullKeyDesc, 100, "%s%s", mod->desc, key->desc);
- }
-
- keySet->addHardwareKey(new HardwareKey(fullKeyId, KeyState(key->keycode, ascii, mod->flag), fullKeyDesc, key->preferredAction ));
- }
+ snprintf(fullKeyId, 50, "S+%s", mod->id);
+ snprintf(fullKeyDesc, 100, "Shift+%s", mod->desc);
+
+ keySet->addHardwareMod(new HardwareMod(fullKeyId, mod->flag, fullKeyDesc));
+ }
+ for (key = keys; key->hwId; key++) {
+ ascii = key->ascii;
+
+ 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));
}
return keySet;
diff --git a/gui/GuiManager.cpp b/gui/GuiManager.cpp
index b97a62109b..ca1fdef41c 100644
--- a/gui/GuiManager.cpp
+++ b/gui/GuiManager.cpp
@@ -273,8 +273,8 @@ void GuiManager::runLoop() {
lastRedraw = _system->getMillis();
}
- Common::Event event;
- while (eventMan->pollEvent(event)) {
+ Common::Event Event;
+ while (eventMan->pollEvent(Event)) {
// The top dialog can change during the event loop. In that case, flush all the
// dialog-related events since they were probably generated while the old dialog
@@ -282,10 +282,10 @@ void GuiManager::runLoop() {
//
// This hopefully fixes strange behaviour/crashes with pop-up widgets. (Most easily
// triggered in 3x mode or when running ScummVM under Valgrind.)
- if (activeDialog != getTopDialog() && event.type != Common::EVENT_SCREEN_CHANGED)
+ if (activeDialog != getTopDialog() && Event.type != Common::EVENT_SCREEN_CHANGED)
continue;
- Common::Point mouse(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y);
+ Common::Point mouse(Event.mouse.x - activeDialog->_x, Event.mouse.y - activeDialog->_y);
if (lastRedraw + waitTime < _system->getMillis()) {
_theme->updateScreen();
@@ -293,12 +293,12 @@ void GuiManager::runLoop() {
lastRedraw = _system->getMillis();
}
- switch (event.type) {
+ switch (Event.type) {
case Common::EVENT_KEYDOWN:
- activeDialog->handleKeyDown(event.kbd);
+ activeDialog->handleKeyDown(Event.kbd);
break;
case Common::EVENT_KEYUP:
- activeDialog->handleKeyUp(event.kbd);
+ activeDialog->handleKeyUp(Event.kbd);
break;
case Common::EVENT_MOUSEMOVE:
activeDialog->handleMouseMoved(mouse.x, mouse.y, 0);
@@ -306,15 +306,15 @@ void GuiManager::runLoop() {
// We don't distinguish between mousebuttons (for now at least)
case Common::EVENT_LBUTTONDOWN:
case Common::EVENT_RBUTTONDOWN:
- button = (event.type == Common::EVENT_LBUTTONDOWN ? 1 : 2);
+ button = (Event.type == Common::EVENT_LBUTTONDOWN ? 1 : 2);
time = _system->getMillis();
if (_lastClick.count && (time < _lastClick.time + kDoubleClickDelay)
- && ABS(_lastClick.x - event.mouse.x) < 3
- && ABS(_lastClick.y - event.mouse.y) < 3) {
+ && ABS(_lastClick.x - Event.mouse.x) < 3
+ && ABS(_lastClick.y - Event.mouse.y) < 3) {
_lastClick.count++;
} else {
- _lastClick.x = event.mouse.x;
- _lastClick.y = event.mouse.y;
+ _lastClick.x = Event.mouse.x;
+ _lastClick.y = Event.mouse.y;
_lastClick.count = 1;
}
_lastClick.time = time;
@@ -322,7 +322,7 @@ void GuiManager::runLoop() {
break;
case Common::EVENT_LBUTTONUP:
case Common::EVENT_RBUTTONUP:
- button = (event.type == Common::EVENT_LBUTTONUP ? 1 : 2);
+ button = (Event.type == Common::EVENT_LBUTTONUP ? 1 : 2);
activeDialog->handleMouseUp(mouse.x, mouse.y, button, _lastClick.count);
break;
case Common::EVENT_WHEELUP: