diff --git a/data/raw/keybindings.json b/data/raw/keybindings.json index 712b906e79791..4dfa339ea969a 100644 --- a/data/raw/keybindings.json +++ b/data/raw/keybindings.json @@ -18,35 +18,35 @@ "id": "UP", "category": "UILIST", "name": "Pan up", - "bindings": [ { "input_method": "keyboard", "key": "UP" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "UP" } ] }, { "type": "keybinding", "id": "DOWN", "category": "UILIST", "name": "Pan down", - "bindings": [ { "input_method": "keyboard", "key": "DOWN" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "DOWN" } ] }, { "type": "keybinding", "id": "FILTER", "category": "UILIST", "name": "Filter", - "bindings": [ { "input_method": "keyboard", "key": "/" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "/" }, { "input_method": "keyboard_code", "key": "KEYPAD_DIVIDE" } ] }, { "type": "keybinding", "id": "QUIT", "category": "UILIST", "name": "Cancel menu", - "bindings": [ { "input_method": "keyboard", "key": "ESC" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "ESC" } ] }, { "type": "keybinding", "id": "SHOW_DESCRIPTION", "category": "MELEE_STYLE_PICKER", "name": "Show description of melee style", - "bindings": [ { "input_method": "keyboard", "key": "F1" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "F1" } ] }, { "type": "keybinding", @@ -67,37 +67,38 @@ "id": "UP", "category": "MELEE_STYLE_PICKER", "name": "Pan up", - "bindings": [ { "input_method": "keyboard", "key": "UP" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "UP" } ] }, { "type": "keybinding", "id": "DOWN", "category": "MELEE_STYLE_PICKER", "name": "Pan down", - "bindings": [ { "input_method": "keyboard", "key": "DOWN" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "DOWN" } ] }, { "type": "keybinding", "id": "FILTER", "category": "MELEE_STYLE_PICKER", "name": "Filter", - "bindings": [ { "input_method": "keyboard", "key": "/" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "/" }, { "input_method": "keyboard_code", "key": "KEYPAD_DIVIDE" } ] }, { "type": "keybinding", "id": "QUIT", "category": "MELEE_STYLE_PICKER", "name": "Cancel menu", - "bindings": [ { "input_method": "keyboard", "key": "ESC" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "ESC" } ] }, { "type": "keybinding", "id": "UP", "name": "Pan up", "bindings": [ - { "input_method": "keyboard", "key": "k" }, - { "input_method": "keyboard", "key": "8" }, - { "input_method": "keyboard", "key": "UP" }, + { "input_method": "keyboard_any", "key": "k" }, + { "input_method": "keyboard_any", "key": "8" }, + { "input_method": "keyboard_code", "key": "KEYPAD_8" }, + { "input_method": "keyboard_any", "key": "UP" }, { "input_method": "gamepad", "key": "JOY_UP" } ] }, @@ -106,9 +107,10 @@ "id": "DOWN", "name": "Pan down", "bindings": [ - { "input_method": "keyboard", "key": "j" }, - { "input_method": "keyboard", "key": "DOWN" }, - { "input_method": "keyboard", "key": "2" }, + { "input_method": "keyboard_any", "key": "j" }, + { "input_method": "keyboard_any", "key": "DOWN" }, + { "input_method": "keyboard_any", "key": "2" }, + { "input_method": "keyboard_code", "key": "KEYPAD_2" }, { "input_method": "gamepad", "key": "JOY_DOWN" } ] }, @@ -117,9 +119,10 @@ "id": "LEFT", "name": "Pan left", "bindings": [ - { "input_method": "keyboard", "key": "h" }, - { "input_method": "keyboard", "key": "LEFT" }, - { "input_method": "keyboard", "key": "4" }, + { "input_method": "keyboard_any", "key": "h" }, + { "input_method": "keyboard_any", "key": "LEFT" }, + { "input_method": "keyboard_any", "key": "4" }, + { "input_method": "keyboard_code", "key": "KEYPAD_4" }, { "input_method": "gamepad", "key": "JOY_LEFT" } ] }, @@ -128,9 +131,10 @@ "id": "RIGHT", "name": "Pan right", "bindings": [ - { "input_method": "keyboard", "key": "l" }, - { "input_method": "keyboard", "key": "RIGHT" }, - { "input_method": "keyboard", "key": "6" }, + { "input_method": "keyboard_any", "key": "l" }, + { "input_method": "keyboard_any", "key": "RIGHT" }, + { "input_method": "keyboard_any", "key": "6" }, + { "input_method": "keyboard_code", "key": "KEYPAD_6" }, { "input_method": "gamepad", "key": "JOY_RIGHT" } ] }, @@ -139,8 +143,9 @@ "id": "LEFTUP", "name": "Pan up-left", "bindings": [ - { "input_method": "keyboard", "key": "y" }, - { "input_method": "keyboard", "key": "7" }, + { "input_method": "keyboard_any", "key": "y" }, + { "input_method": "keyboard_any", "key": "7" }, + { "input_method": "keyboard_code", "key": "KEYPAD_7" }, { "input_method": "gamepad", "key": "JOY_LEFTUP" } ] }, @@ -149,8 +154,9 @@ "id": "RIGHTUP", "name": "Pan up-right", "bindings": [ - { "input_method": "keyboard", "key": "u" }, - { "input_method": "keyboard", "key": "9" }, + { "input_method": "keyboard_any", "key": "u" }, + { "input_method": "keyboard_any", "key": "9" }, + { "input_method": "keyboard_code", "key": "KEYPAD_9" }, { "input_method": "gamepad", "key": "JOY_RIGHTUP" } ] }, @@ -159,8 +165,9 @@ "id": "LEFTDOWN", "name": "Pan down-left", "bindings": [ - { "input_method": "keyboard", "key": "b" }, - { "input_method": "keyboard", "key": "1" }, + { "input_method": "keyboard_any", "key": "b" }, + { "input_method": "keyboard_any", "key": "1" }, + { "input_method": "keyboard_code", "key": "KEYPAD_1" }, { "input_method": "gamepad", "key": "JOY_LEFTDOWN" } ] }, @@ -169,8 +176,9 @@ "id": "RIGHTDOWN", "name": "Pan down-right", "bindings": [ - { "input_method": "keyboard", "key": "n" }, - { "input_method": "keyboard", "key": "3" }, + { "input_method": "keyboard_any", "key": "n" }, + { "input_method": "keyboard_any", "key": "3" }, + { "input_method": "keyboard_code", "key": "KEYPAD_3" }, { "input_method": "gamepad", "key": "JOY_RIGHTDOWN" } ] }, @@ -178,13 +186,13 @@ "type": "keybinding", "id": "PAGE_UP", "name": "Page up", - "bindings": [ { "input_method": "keyboard", "key": "PPAGE" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "PPAGE" } ] }, { "type": "keybinding", "id": "PAGE_DOWN", "name": "Page down", - "bindings": [ { "input_method": "keyboard", "key": "NPAGE" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "NPAGE" } ] }, { "type": "keybinding", @@ -203,21 +211,21 @@ "id": "SELECT_ALL", "category": "PICKUP", "name": "Select all", - "bindings": [ { "input_method": "keyboard", "key": "," } ] + "bindings": [ { "input_method": "keyboard_any", "key": "," } ] }, { "type": "keybinding", "id": "SCROLL_UP", "category": "PICKUP", "name": "Scroll item info up", - "bindings": [ { "input_method": "keyboard", "key": "PPAGE" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "PPAGE" } ] }, { "type": "keybinding", "id": "SCROLL_DOWN", "category": "PICKUP", "name": "Scroll item info down", - "bindings": [ { "input_method": "keyboard", "key": "NPAGE" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "NPAGE" } ] }, { "type": "keybinding", @@ -225,8 +233,8 @@ "category": "PICKUP", "name": "Previous item", "bindings": [ - { "input_method": "keyboard", "key": "k" }, - { "input_method": "keyboard", "key": "UP" }, + { "input_method": "keyboard_any", "key": "k" }, + { "input_method": "keyboard_any", "key": "UP" }, { "input_method": "gamepad", "key": "JOY_UP" } ] }, @@ -236,8 +244,8 @@ "category": "PICKUP", "name": "Next item", "bindings": [ - { "input_method": "keyboard", "key": "j" }, - { "input_method": "keyboard", "key": "DOWN" }, + { "input_method": "keyboard_any", "key": "j" }, + { "input_method": "keyboard_any", "key": "DOWN" }, { "input_method": "gamepad", "key": "JOY_DOWN" } ] }, @@ -247,8 +255,8 @@ "category": "PICKUP", "name": "Unmark selected item", "bindings": [ - { "input_method": "keyboard", "key": "h" }, - { "input_method": "keyboard", "key": "LEFT" }, + { "input_method": "keyboard_any", "key": "h" }, + { "input_method": "keyboard_any", "key": "LEFT" }, { "input_method": "gamepad", "key": "JOY_LEFT" } ] }, @@ -258,8 +266,8 @@ "category": "PICKUP", "name": "Mark selected item", "bindings": [ - { "input_method": "keyboard", "key": "l" }, - { "input_method": "keyboard", "key": "RIGHT" }, + { "input_method": "keyboard_any", "key": "l" }, + { "input_method": "keyboard_any", "key": "RIGHT" }, { "input_method": "gamepad", "key": "JOY_RIGHT" } ] }, @@ -268,446 +276,564 @@ "id": "ENABLE_MAPEXTRA_NOTE", "category": "AUTO_NOTES", "name": "Enable auto note for map extra", - "bindings": [ { "input_method": "keyboard", "key": "e" }, { "input_method": "keyboard", "key": "E" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "e" }, + { "input_method": "keyboard_char", "key": "E" }, + { "input_method": "keyboard_code", "key": "e", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "SWITCH_AUTO_NOTE_OPTION", "category": "AUTO_NOTES", "name": "Toggle auto notes option", - "bindings": [ { "input_method": "keyboard", "key": "s" }, { "input_method": "keyboard", "key": "S" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "s" }, + { "input_method": "keyboard_char", "key": "S" }, + { "input_method": "keyboard_code", "key": "s", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "DISABLE_MAPEXTRA_NOTE", "category": "AUTO_NOTES", "name": "Disable auto note for map extra", - "bindings": [ { "input_method": "keyboard", "key": "d" }, { "input_method": "keyboard", "key": "D" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "d" }, + { "input_method": "keyboard_char", "key": "D" }, + { "input_method": "keyboard_code", "key": "d", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "ADD_RULE", "category": "AUTO_PICKUP", "name": "Add rule", - "bindings": [ { "input_method": "keyboard", "key": "a" }, { "input_method": "keyboard", "key": "A" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "a" }, + { "input_method": "keyboard_char", "key": "A" }, + { "input_method": "keyboard_code", "key": "a", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "REMOVE_RULE", "category": "AUTO_PICKUP", "name": "Remove rule", - "bindings": [ { "input_method": "keyboard", "key": "r" }, { "input_method": "keyboard", "key": "R" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "r" }, + { "input_method": "keyboard_char", "key": "R" }, + { "input_method": "keyboard_code", "key": "r", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "COPY_RULE", "category": "AUTO_PICKUP", "name": "Copy rule", - "bindings": [ { "input_method": "keyboard", "key": "c" }, { "input_method": "keyboard", "key": "C" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "c" }, + { "input_method": "keyboard_char", "key": "C" }, + { "input_method": "keyboard_code", "key": "c", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "SWAP_RULE_GLOBAL_CHAR", "category": "AUTO_PICKUP", "name": "Move rule global <-> character", - "bindings": [ { "input_method": "keyboard", "key": "m" }, { "input_method": "keyboard", "key": "M" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "m" }, + { "input_method": "keyboard_char", "key": "M" }, + { "input_method": "keyboard_code", "key": "m", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "ENABLE_RULE", "category": "AUTO_PICKUP", "name": "Enable rule", - "bindings": [ { "input_method": "keyboard", "key": "e" }, { "input_method": "keyboard", "key": "E" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "e" }, + { "input_method": "keyboard_char", "key": "E" }, + { "input_method": "keyboard_code", "key": "e", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "DISABLE_RULE", "category": "AUTO_PICKUP", "name": "Disable rule", - "bindings": [ { "input_method": "keyboard", "key": "d" }, { "input_method": "keyboard", "key": "D" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "d" }, + { "input_method": "keyboard_char", "key": "D" }, + { "input_method": "keyboard_code", "key": "d", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "MOVE_RULE_UP", "category": "AUTO_PICKUP", "name": "Move rule up", - "bindings": [ { "input_method": "keyboard", "key": "+" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "+" }, + { "input_method": "keyboard_code", "key": "KEYPAD_PLUS" }, + { "input_method": "keyboard_code", "key": "=", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "MOVE_RULE_DOWN", "category": "AUTO_PICKUP", "name": "Move rule down", - "bindings": [ { "input_method": "keyboard", "key": "-" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "-" }, { "input_method": "keyboard_code", "key": "KEYPAD_MINUS" } ] }, { "type": "keybinding", "id": "TEST_RULE", "category": "AUTO_PICKUP", "name": "Test rule", - "bindings": [ { "input_method": "keyboard", "key": "t" }, { "input_method": "keyboard", "key": "T" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "t" }, + { "input_method": "keyboard_char", "key": "T" }, + { "input_method": "keyboard_code", "key": "t", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "SWITCH_AUTO_PICKUP_OPTION", "category": "AUTO_PICKUP", "name": "Enable auto pickup option", - "bindings": [ { "input_method": "keyboard", "key": "s" }, { "input_method": "keyboard", "key": "S" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "s" }, + { "input_method": "keyboard_char", "key": "S" }, + { "input_method": "keyboard_code", "key": "s", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "ADD_DEFAULT_RULESET", "category": "SAFEMODE", "name": "Add default ruleset", - "bindings": [ { "input_method": "keyboard", "key": "~" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "~" }, { "input_method": "keyboard_code", "key": "`", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "ADD_RULE", "category": "SAFEMODE", "name": "Add rule", - "bindings": [ { "input_method": "keyboard", "key": "a" }, { "input_method": "keyboard", "key": "A" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "a" }, + { "input_method": "keyboard_char", "key": "A" }, + { "input_method": "keyboard_code", "key": "a", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "REMOVE_RULE", "category": "SAFEMODE", "name": "Remove rule", - "bindings": [ { "input_method": "keyboard", "key": "r" }, { "input_method": "keyboard", "key": "R" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "r" }, + { "input_method": "keyboard_char", "key": "R" }, + { "input_method": "keyboard_code", "key": "r", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "COPY_RULE", "category": "SAFEMODE", "name": "Copy rule", - "bindings": [ { "input_method": "keyboard", "key": "c" }, { "input_method": "keyboard", "key": "C" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "c" }, + { "input_method": "keyboard_char", "key": "C" }, + { "input_method": "keyboard_code", "key": "c", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "SWAP_RULE_GLOBAL_CHAR", "category": "SAFEMODE", "name": "Move rule global <-> character", - "bindings": [ { "input_method": "keyboard", "key": "m" }, { "input_method": "keyboard", "key": "M" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "m" }, + { "input_method": "keyboard_char", "key": "M" }, + { "input_method": "keyboard_code", "key": "m", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "ENABLE_RULE", "category": "SAFEMODE", "name": "Enable rule", - "bindings": [ { "input_method": "keyboard", "key": "e" }, { "input_method": "keyboard", "key": "E" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "e" }, + { "input_method": "keyboard_char", "key": "E" }, + { "input_method": "keyboard_code", "key": "e", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "DISABLE_RULE", "category": "SAFEMODE", "name": "Disable rule", - "bindings": [ { "input_method": "keyboard", "key": "d" }, { "input_method": "keyboard", "key": "D" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "d" }, + { "input_method": "keyboard_char", "key": "D" }, + { "input_method": "keyboard_code", "key": "d", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "MOVE_RULE_UP", "category": "SAFEMODE", "name": "Move rule up", - "bindings": [ { "input_method": "keyboard", "key": "+" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "+" }, + { "input_method": "keyboard_code", "key": "KEYPAD_PLUS" }, + { "input_method": "keyboard_code", "key": "=", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "MOVE_RULE_DOWN", "category": "SAFEMODE", "name": "Move rule down", - "bindings": [ { "input_method": "keyboard", "key": "-" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "-" }, { "input_method": "keyboard_code", "key": "KEYPAD_MINUS" } ] }, { "type": "keybinding", "id": "TEST_RULE", "category": "SAFEMODE", "name": "Test rule", - "bindings": [ { "input_method": "keyboard", "key": "t" }, { "input_method": "keyboard", "key": "T" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "t" }, + { "input_method": "keyboard_char", "key": "T" }, + { "input_method": "keyboard_code", "key": "t", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "SWITCH_SAFEMODE_OPTION", "category": "SAFEMODE", "name": "Enable safemode option", - "bindings": [ { "input_method": "keyboard", "key": "s" }, { "input_method": "keyboard", "key": "S" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "s" }, + { "input_method": "keyboard_char", "key": "S" }, + { "input_method": "keyboard_code", "key": "s", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "USAGE_HELP", "category": "SORT_ARMOR", "name": "Display Usage Help", - "bindings": [ { "input_method": "keyboard", "key": "F1" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "F1" } ] }, { "type": "keybinding", "id": "MOVE_ARMOR", "category": "SORT_ARMOR", "name": "Select armor for moving", - "bindings": [ { "input_method": "keyboard", "key": "s" }, { "input_method": "keyboard", "key": "RETURN" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "s" }, + { "input_method": "keyboard_any", "key": "RETURN" }, + { "input_method": "keyboard_code", "key": "KEYPAD_ENTER" } + ] }, { "type": "keybinding", "id": "MOVE_PANEL", "category": "PANEL_MGMT", "name": "Select panel for moving", - "bindings": [ { "input_method": "keyboard", "key": "s" }, { "input_method": "keyboard", "key": "RETURN" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "s" }, + { "input_method": "keyboard_any", "key": "RETURN" }, + { "input_method": "keyboard_code", "key": "KEYPAD_ENTER" } + ] }, { "type": "keybinding", "id": "TOGGLE_PANEL", "category": "PANEL_MGMT", "name": "Toggle panel off", - "bindings": [ { "input_method": "keyboard", "key": "TAB" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "TAB" } ] }, { "type": "keybinding", "id": "CHANGE_SIDE", "category": "SORT_ARMOR", "name": "Change side armor is worn on", - "bindings": [ { "input_method": "keyboard", "key": "c" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "c" } ] }, { "type": "keybinding", "id": "ASSIGN_INVLETS", "category": "SORT_ARMOR", "name": "Assign invlets to armor", - "bindings": [ { "input_method": "keyboard", "key": "r" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "r" } ] }, { "type": "keybinding", "id": "SORT_ARMOR", "category": "SORT_ARMOR", "name": "Sort armor into natural layer order", - "bindings": [ { "input_method": "keyboard", "key": "S" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "S" }, { "input_method": "keyboard_code", "key": "s", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "EQUIP_ARMOR", "category": "SORT_ARMOR", "name": "Equip armor from inventory", - "bindings": [ { "input_method": "keyboard", "key": "e" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "e" } ] }, { "type": "keybinding", "id": "EQUIP_ARMOR_HERE", "category": "SORT_ARMOR", "name": "Equip armor from inventory at this position", - "bindings": [ { "input_method": "keyboard", "key": "E" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "E" }, { "input_method": "keyboard_code", "key": "e", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "REMOVE_ARMOR", "category": "SORT_ARMOR", "name": "Unequip selected armor", - "bindings": [ { "input_method": "keyboard", "key": "u" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "u" } ] }, { "type": "keybinding", "id": "HELP_KEYBINDINGS", "name": "Display keybindings menu", - "bindings": [ { "input_method": "keyboard", "key": "?" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "?" }, { "input_method": "keyboard_code", "key": "/", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "FILTER", "name": "Filter", "bindings": [ - { "input_method": "keyboard", "key": "f" }, - { "input_method": "keyboard", "key": "F" }, - { "input_method": "keyboard", "key": "/" } + { "input_method": "keyboard_any", "key": "f" }, + { "input_method": "keyboard_char", "key": "F" }, + { "input_method": "keyboard_code", "key": "f", "mod": [ "shift" ] }, + { "input_method": "keyboard_any", "key": "/" }, + { "input_method": "keyboard_code", "key": "KEYPAD_DIVIDE" } ] }, { "type": "keybinding", "id": "RESET_FILTER", "name": "Reset filter", - "bindings": [ { "input_method": "keyboard", "key": "r" }, { "input_method": "keyboard", "key": "R" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "r" }, + { "input_method": "keyboard_char", "key": "R" }, + { "input_method": "keyboard_code", "key": "r", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "CYCLE_MODE", "category": "CRAFTING", "name": "Cycle display mode", - "bindings": [ { "input_method": "keyboard", "key": "m" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "m" } ] }, { "type": "keybinding", "id": "HELP_RECIPE", "category": "CRAFTING", "name": "Show recipe result", - "bindings": [ { "input_method": "keyboard", "key": "e" }, { "input_method": "keyboard", "key": "E" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "e" }, + { "input_method": "keyboard_char", "key": "E" }, + { "input_method": "keyboard_code", "key": "e", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "HIDE_SHOW_RECIPE", "category": "CRAFTING", "name": "Hide/show recipe", - "bindings": [ { "input_method": "keyboard", "key": "s" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "s" } ] }, { "type": "keybinding", "id": "CYCLE_BATCH", "category": "CRAFTING", "name": "Batch crafting", - "bindings": [ { "input_method": "keyboard", "key": [ "b" ] } ] + "bindings": [ { "input_method": "keyboard_any", "key": [ "b" ] } ] }, { "type": "keybinding", "id": "SCROLL_UP", "category": "CRAFTING", "name": "Scroll item info up", - "bindings": [ { "input_method": "keyboard", "key": "PPAGE" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "PPAGE" } ] }, { "type": "keybinding", "id": "SCROLL_DOWN", "category": "CRAFTING", "name": "Scroll item info down", - "bindings": [ { "input_method": "keyboard", "key": "NPAGE" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "NPAGE" } ] }, { "type": "keybinding", "id": "RELATED_RECIPES", "category": "CRAFTING", "name": "Related recipes", - "bindings": [ { "input_method": "keyboard", "key": "L" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "L" }, { "input_method": "keyboard_code", "key": "l", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "TOGGLE_FAVORITE", "category": "CRAFTING", "name": "Toggle recipes to be shown in favorite tab", - "bindings": [ { "input_method": "keyboard", "key": "*" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "*" }, + { "input_method": "keyboard_code", "key": "KEYPAD_MULTIPLY" }, + { "input_method": "keyboard_code", "key": "8", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "LEVEL_UP", "name": "Go Up", - "bindings": [ { "input_method": "keyboard", "key": "<" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "<" }, { "input_method": "keyboard_code", "key": ",", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "LEVEL_DOWN", "name": "Go Down", - "bindings": [ { "input_method": "keyboard", "key": ">" } ] + "bindings": [ { "input_method": "keyboard_char", "key": ">" }, { "input_method": "keyboard_code", "key": ".", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "NEXT", "category": "SOKOBAN", "name": "Next level", - "bindings": [ { "input_method": "keyboard", "key": "+" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "+" }, + { "input_method": "keyboard_code", "key": "KEYPAD_PLUS" }, + { "input_method": "keyboard_code", "key": "=", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "PREV", "category": "SOKOBAN", "name": "Previous level", - "bindings": [ { "input_method": "keyboard", "key": "-" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "-" }, { "input_method": "keyboard_code", "key": "KEYPAD_MINUS" } ] }, { "type": "keybinding", "id": "RESET", "category": "SOKOBAN", "name": "Reset level", - "bindings": [ { "input_method": "keyboard", "key": "r" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "r" } ] }, { "type": "keybinding", "id": "UNDO", "category": "SOKOBAN", "name": "Undo move", - "bindings": [ { "input_method": "keyboard", "key": "u" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "u" } ] }, { "type": "keybinding", "id": "NEW", "category": "MINESWEEPER", "name": "Create New level", - "bindings": [ { "input_method": "keyboard", "key": "n" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "n" } ] }, { "type": "keybinding", "id": "FLAG", "category": "MINESWEEPER", "name": "Toggle Flag", - "bindings": [ { "input_method": "keyboard", "key": "f" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "f" } ] }, { "type": "keybinding", "id": "TOGGLE_SPACE", "category": "LIGHTSON", "name": "Toggle lights", - "bindings": [ { "input_method": "keyboard", "key": " " } ] + "bindings": [ { "input_method": "keyboard_any", "key": " " } ] }, { "type": "keybinding", "id": "TOGGLE_5", "category": "LIGHTSON", "name": "Toggle lights", - "bindings": [ { "input_method": "keyboard", "key": "5" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "5" }, { "input_method": "keyboard_code", "key": "KEYPAD_5" } ] }, { "type": "keybinding", "id": "RESET", "category": "LIGHTSON", "name": "Reset level", - "bindings": [ { "input_method": "keyboard", "key": "r" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "r" } ] }, { "type": "keybinding", "id": "CONFIRM", "name": "Confirm Choice", - "bindings": [ { "input_method": "keyboard", "key": "RETURN" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "RETURN" }, { "input_method": "keyboard_code", "key": "KEYPAD_ENTER" } ] }, { "type": "keybinding", "id": "SAVE_DEFAULT_MODS", "category": "MODMANAGER_DIALOG", "name": "Save mods as default", - "bindings": [ { "input_method": "keyboard", "key": "s" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "s" } ] }, { "type": "keybinding", "id": "VIEW_MOD_DESCRIPTION", "category": "MODMANAGER_DIALOG", "name": "View full mod description", - "bindings": [ { "input_method": "keyboard", "key": "v" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "v" } ] }, { "type": "keybinding", "id": "ADD_MOD", "category": "MODMANAGER_DIALOG", "name": "Move selected mod up", - "bindings": [ { "input_method": "keyboard", "key": "+" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "+" }, + { "input_method": "keyboard_code", "key": "KEYPAD_PLUS" }, + { "input_method": "keyboard_code", "key": "=", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "REMOVE_MOD", "category": "MODMANAGER_DIALOG", "name": "Move selected mod down", - "bindings": [ { "input_method": "keyboard", "key": "-" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "-" }, { "input_method": "keyboard_code", "key": "KEYPAD_MINUS" } ] }, { "type": "keybinding", "id": "NEXT_CATEGORY_TAB", "category": "MODMANAGER_DIALOG", "name": "Move to next category tab", - "bindings": [ { "input_method": "keyboard", "key": ">" } ] + "bindings": [ { "input_method": "keyboard_char", "key": ">" }, { "input_method": "keyboard_code", "key": ".", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "PREV_CATEGORY_TAB", "category": "MODMANAGER_DIALOG", "name": "Move to previous category tab", - "bindings": [ { "input_method": "keyboard", "key": "<" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "<" }, { "input_method": "keyboard_code", "key": ",", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "PICK_RANDOM_WORLDNAME", "category": "WORLDGEN_CONFIRM_DIALOG", "name": "Pick random world name", - "bindings": [ { "input_method": "keyboard", "key": "*" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "*" }, + { "input_method": "keyboard_code", "key": "KEYPAD_MULTIPLY" }, + { "input_method": "keyboard_code", "key": "8", "mod": [ "shift" ] } + ] }, { "type": "keybinding", @@ -715,149 +841,150 @@ "category": "WORLDGEN_CONFIRM_DIALOG", "name": "Exit worldgen screen", "//": "separate entry, because the global entry also has 'q' and 'Q' listed, which conflicts with the world name entry feature of this dialog", - "bindings": [ { "input_method": "keyboard", "key": "ESC" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "ESC" } ] }, { "type": "keybinding", "id": "DELETE_NOTE", "category": "OVERMAP_NOTES", "name": "Delete Note", - "bindings": [ { "input_method": "keyboard", "key": "D" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "D" }, { "input_method": "keyboard_code", "key": "d", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "EDIT_NOTE", "category": "OVERMAP_NOTES", "name": "Edit Note", - "bindings": [ { "input_method": "keyboard", "key": "E" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "E" }, { "input_method": "keyboard_code", "key": "e", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "MARK_DANGER", "category": "OVERMAP_NOTES", "name": "Mark as Dangerous", - "bindings": [ { "input_method": "keyboard", "key": "M" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "M" }, { "input_method": "keyboard_code", "key": "m", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "DELETE_NOTE", "category": "OVERMAP", "name": "Delete Note", - "bindings": [ { "input_method": "keyboard", "key": "D" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "D" }, { "input_method": "keyboard_code", "key": "d", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "CREATE_NOTE", "category": "OVERMAP", "name": "Create/Edit Note", - "bindings": [ { "input_method": "keyboard", "key": "N" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "N" }, { "input_method": "keyboard_code", "key": "n", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "LIST_NOTES", "category": "OVERMAP", "name": "List Notes", - "bindings": [ { "input_method": "keyboard", "key": "L" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "L" }, { "input_method": "keyboard_code", "key": "l", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "TOGGLE_BLINKING", "category": "OVERMAP", "name": "Toggle Blinking", - "bindings": [ { "input_method": "keyboard", "key": "B" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "B" }, { "input_method": "keyboard_code", "key": "b", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "TOGGLE_OVERLAYS", "category": "OVERMAP", "name": "Toggle Overlays", - "bindings": [ { "input_method": "keyboard", "key": "O" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "O" }, { "input_method": "keyboard_code", "key": "o", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "TOGGLE_LAND_USE_CODES", "category": "OVERMAP", "name": "Toggle Land Use Codes", - "bindings": [ { "input_method": "keyboard", "key": "A" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "A" }, { "input_method": "keyboard_code", "key": "a", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "TOGGLE_MAP_NOTES", "category": "OVERMAP", "name": "Toggle Map Notes", - "bindings": [ { "input_method": "keyboard", "key": "G" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "G" }, { "input_method": "keyboard_code", "key": "g", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "TOGGLE_CITY_LABELS", "category": "OVERMAP", "name": "Toggle City Labels", - "bindings": [ { "input_method": "keyboard", "key": "C" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "C" }, { "input_method": "keyboard_code", "key": "c", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "TOGGLE_HORDES", "category": "OVERMAP", "name": "Toggle Hordes", - "bindings": [ { "input_method": "keyboard", "key": "H" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "H" }, { "input_method": "keyboard_code", "key": "h", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "TOGGLE_FOREST_TRAILS", "category": "OVERMAP", "name": "Toggle Forest Trails", - "bindings": [ { "input_method": "keyboard", "key": "T" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "T" }, { "input_method": "keyboard_code", "key": "t", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "TOGGLE_EXPLORED", "category": "OVERMAP", "name": "Toggle Explored", - "bindings": [ { "input_method": "keyboard", "key": "E" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "E" }, { "input_method": "keyboard_code", "key": "e", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "PLACE_TERRAIN", "category": "OVERMAP", "name": "Place Overmap Terrain", - "bindings": [ { "input_method": "keyboard", "key": "t" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "t" } ] }, { "type": "keybinding", "id": "PLACE_SPECIAL", "category": "OVERMAP", "name": "Place Overmap Special", - "bindings": [ { "input_method": "keyboard", "key": "s" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "s" } ] }, { "type": "keybinding", "name": "View Missions", "category": "OVERMAP", "id": "MISSIONS", - "bindings": [ { "input_method": "keyboard", "key": "M" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "M" }, { "input_method": "keyboard_code", "key": "m", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "ROTATE", "category": "OVERMAP_EDITOR", "name": "Rotate", - "bindings": [ { "input_method": "keyboard", "key": "r" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "r" } ] }, { "type": "keybinding", "id": "SEARCH", "name": "Search", - "bindings": [ { "input_method": "keyboard", "key": "/" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "/" }, { "input_method": "keyboard_code", "key": "KEYPAD_DIVIDE" } ] }, { "type": "keybinding", "id": "QUIT", "name": "Exit screen", "bindings": [ - { "input_method": "keyboard", "key": "ESC" }, - { "input_method": "keyboard", "key": "q" }, - { "input_method": "keyboard", "key": "Q" }, - { "input_method": "keyboard", "key": "SPACE" }, + { "input_method": "keyboard_any", "key": "ESC" }, + { "input_method": "keyboard_any", "key": "q" }, + { "input_method": "keyboard_char", "key": "Q" }, + { "input_method": "keyboard_code", "key": "q", "mod": [ "shift" ] }, + { "input_method": "keyboard_any", "key": "SPACE" }, { "input_method": "gamepad", "key": "JOY_3" } ] }, @@ -865,7 +992,7 @@ "type": "keybinding", "id": "CHOOSE_DESTINATION", "name": "Choose destination", - "bindings": [ { "input_method": "keyboard", "key": "W" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "W" }, { "input_method": "keyboard_code", "key": "w", "mod": [ "shift" ] } ] }, { "type": "keybinding", @@ -873,8 +1000,9 @@ "category": "TARGET", "name": "Fire Weapon", "bindings": [ - { "input_method": "keyboard", "key": "f" }, - { "input_method": "keyboard", "key": "RETURN" }, + { "input_method": "keyboard_any", "key": "f" }, + { "input_method": "keyboard_any", "key": "RETURN" }, + { "input_method": "keyboard_code", "key": "KEYPAD_ENTER" }, { "input_method": "mouse", "key": "MOUSE_RIGHT" } ] }, @@ -884,9 +1012,10 @@ "category": "TARGET", "name": "Prev Target", "bindings": [ - { "input_method": "keyboard", "key": "BACKTAB" }, + { "input_method": "keyboard_char", "key": "BACKTAB" }, + { "input_method": "keyboard_code", "key": "TAB", "mod": [ "shift" ] }, { "input_method": "mouse", "key": "SCROLL_UP" }, - { "input_method": "keyboard", "key": "PPAGE" } + { "input_method": "keyboard_any", "key": "PPAGE" } ] }, { @@ -895,9 +1024,9 @@ "category": "TARGET", "name": "Next Target", "bindings": [ - { "input_method": "keyboard", "key": "TAB" }, + { "input_method": "keyboard_any", "key": "TAB" }, { "input_method": "mouse", "key": "SCROLL_DOWN" }, - { "input_method": "keyboard", "key": "NPAGE" } + { "input_method": "keyboard_any", "key": "NPAGE" } ] }, { @@ -905,70 +1034,83 @@ "id": "AIM", "category": "TARGET", "name": "Aim", - "bindings": [ { "input_method": "keyboard", "key": "." }, { "input_method": "keyboard", "key": "5" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "." }, + { "input_method": "keyboard_code", "key": "KEYPAD_PERIOD" }, + { "input_method": "keyboard_any", "key": "5" }, + { "input_method": "keyboard_code", "key": "KEYPAD_5" } + ] }, { "type": "keybinding", "id": "AIMED_SHOT", "category": "TARGET", "name": "Aimed Shot", - "bindings": [ { "input_method": "keyboard", "key": "a" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "a" } ] }, { "type": "keybinding", "id": "CAREFUL_SHOT", "category": "TARGET", "name": "Careful Shot", - "bindings": [ { "input_method": "keyboard", "key": "c" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "c" } ] }, { "type": "keybinding", "id": "PRECISE_SHOT", "category": "TARGET", "name": "Precise Shot", - "bindings": [ { "input_method": "keyboard", "key": "p" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "p" } ] }, { "type": "keybinding", "id": "SWITCH_AIM", "category": "TARGET", "name": "Switch Aiming Mode", - "bindings": [ { "input_method": "keyboard", "key": "m" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "m" } ] }, { "type": "keybinding", "id": "SWITCH_AMMO", "category": "TARGET", "name": "Switch ammo", - "bindings": [ { "input_method": "keyboard", "key": "o" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "o" } ] }, { "type": "keybinding", "id": "SWITCH_MODE", "category": "TARGET", "name": "Switch Firing Mode", - "bindings": [ { "input_method": "keyboard", "key": "s" }, { "input_method": "keyboard", "key": "F" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "s" }, + { "input_method": "keyboard_char", "key": "F" }, + { "input_method": "keyboard_code", "key": "f", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "TOGGLE_TURRET_LINES", "category": "TARGET", "name": "Toggle turret lines", - "bindings": [ { "input_method": "keyboard", "key": "t" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "t" } ] }, { "type": "keybinding", "id": "TOGGLE_SNAP_TO_TARGET", "category": "TARGET", "name": "Toggle Snap to Target", - "bindings": [ { "input_method": "keyboard", "key": "*" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "*" }, + { "input_method": "keyboard_code", "key": "KEYPAD_MULTIPLY" }, + { "input_method": "keyboard_code", "key": "8", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "TOGGLE_MOVE_CURSOR_VIEW", "category": "TARGET", "name": "Toggle moving view / cursor", - "bindings": [ { "input_method": "keyboard", "key": "v" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "v" } ] }, { "type": "keybinding", @@ -992,106 +1134,113 @@ "type": "keybinding", "id": "NEXT_TAB", "name": "Go to next tab", - "bindings": [ { "input_method": "keyboard", "key": "TAB" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "TAB" } ] }, { "type": "keybinding", "id": "PREV_TAB", "name": "Go to prev tab", - "bindings": [ { "input_method": "keyboard", "key": "BACKTAB" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "BACKTAB" }, + { "input_method": "keyboard_code", "key": "TAB", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "TOGGLE_FAST_SCROLL", "name": "Toggle Fast Scroll", - "bindings": [ { "input_method": "keyboard", "key": "f" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "f" } ] }, { "type": "keybinding", "id": "EXTENDED_DESCRIPTION", "name": "Show extended description", - "bindings": [ { "input_method": "keyboard", "key": "e" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "e" } ] }, { "type": "keybinding", "id": "TRAVEL_TO", "name": "Travel to destination", - "bindings": [ { "input_method": "keyboard", "key": "T" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "T" }, { "input_method": "keyboard_code", "key": "t", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "CENTER", "name": "Center On Character", - "bindings": [ { "input_method": "keyboard", "key": "0" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "0" }, { "input_method": "keyboard_code", "key": "KEYPAD_0" } ] }, { "type": "keybinding", "id": "HELP", "category": "CARAVAN", "name": "Display Help", - "bindings": [ { "input_method": "keyboard", "key": "0" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "0" }, { "input_method": "keyboard_code", "key": "KEYPAD_0" } ] }, { "type": "keybinding", "id": "CHANGE_GENDER", "name": "Change gender", - "bindings": [ { "input_method": "keyboard", "key": "@" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "@" }, { "input_method": "keyboard_code", "key": "2", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "SAVE_TEMPLATE", "category": "DEFENSE_SETUP", "name": "Save template", - "bindings": [ { "input_method": "keyboard", "key": "!" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "!" }, { "input_method": "keyboard_code", "key": "1", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "START", "category": "DEFENSE_SETUP", "name": "Start", - "bindings": [ { "input_method": "keyboard", "key": "S" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "S" }, { "input_method": "keyboard_code", "key": "s", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "DELETE_TEMPLATE", "category": "MAIN_MENU", "name": "Delete template", - "bindings": [ { "input_method": "keyboard", "key": "d" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "d" } ] }, { "type": "keybinding", "id": "SAVE_TEMPLATE", "category": "NEW_CHAR_DESCRIPTION", "name": "Save template", - "bindings": [ { "input_method": "keyboard", "key": "!" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "!" }, { "input_method": "keyboard_code", "key": "1", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "REROLL_CHARACTER", "category": "NEW_CHAR_DESCRIPTION", "name": "Reroll Random Character", - "bindings": [ { "input_method": "keyboard", "key": "%" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "%" }, { "input_method": "keyboard_code", "key": "5", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "REROLL_CHARACTER_WITH_SCENARIO", "category": "NEW_CHAR_DESCRIPTION", "name": "Reroll Random Character With Scenario", - "bindings": [ { "input_method": "keyboard", "key": "^" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "^" }, { "input_method": "keyboard_code", "key": "6", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "RANDOMIZE_CHAR_DESCRIPTION", "category": "NEW_CHAR_DESCRIPTION", "name": "Pick random character description", - "bindings": [ { "input_method": "keyboard", "key": "*" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "*" }, + { "input_method": "keyboard_code", "key": "KEYPAD_MULTIPLY" }, + { "input_method": "keyboard_code", "key": "8", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "CHOOSE_LOCATION", "category": "NEW_CHAR_DESCRIPTION", "name": "Choose character start location", - "bindings": [ { "input_method": "keyboard", "key": "/" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "/" }, { "input_method": "keyboard_code", "key": "KEYPAD_DIVIDE" } ] }, { "type": "keybinding", @@ -1099,209 +1248,220 @@ "category": "NEW_CHAR_DESCRIPTION", "name": "Exit new character screen", "//": "separate entry, because the global entry also has 'q' and 'Q' listed, which conflicts with the character name entry feature of this dialog", - "bindings": [ { "input_method": "keyboard", "key": "ESC" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "ESC" } ] }, { "type": "keybinding", "id": "SORT", "category": "NEW_CHAR_PROFESSIONS", "name": "Toggle sorting order", - "bindings": [ { "input_method": "keyboard", "key": "s" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "s" } ] }, { "type": "keybinding", "id": "RANDOMIZE", "category": "NEW_CHAR_PROFESSIONS", "name": "Randomize profession", - "bindings": [ { "input_method": "keyboard", "key": "*" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "*" }, + { "input_method": "keyboard_code", "key": "KEYPAD_MULTIPLY" }, + { "input_method": "keyboard_code", "key": "8", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "RANDOMIZE", "category": "NEW_CHAR_SCENARIOS", "name": "Randomize scenario", - "bindings": [ { "input_method": "keyboard", "key": "*" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "*" }, + { "input_method": "keyboard_code", "key": "KEYPAD_MULTIPLY" }, + { "input_method": "keyboard_code", "key": "8", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "SORT", "category": "NEW_CHAR_SCENARIOS", "name": "Toggle sorting order", - "bindings": [ { "input_method": "keyboard", "key": "s" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "s" } ] }, { "type": "keybinding", "id": "SCROLL_UP", "category": "NEW_CHAR_SKILLS", "name": "Scroll description up", - "bindings": [ { "input_method": "keyboard", "key": "PPAGE" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "PPAGE" } ] }, { "type": "keybinding", "id": "SCROLL_DOWN", "category": "NEW_CHAR_SKILLS", "name": "Scroll description down", - "bindings": [ { "input_method": "keyboard", "key": "NPAGE" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "NPAGE" } ] }, { "type": "keybinding", "id": "INSTALL", "category": "VEH_INTERACT", "name": "Install part", - "bindings": [ { "input_method": "keyboard", "key": "i" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "i" } ] }, { "type": "keybinding", "id": "REPAIR", "category": "VEH_INTERACT", "name": "Repair part", - "bindings": [ { "input_method": "keyboard", "key": "r" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "r" } ] }, { "type": "keybinding", "id": "MEND", "category": "VEH_INTERACT", "name": "Mend part", - "bindings": [ { "input_method": "keyboard", "key": "m" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "m" } ] }, { "type": "keybinding", "id": "REFILL", "category": "VEH_INTERACT", "name": "Refill tank/battery", - "bindings": [ { "input_method": "keyboard", "key": "f" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "f" } ] }, { "type": "keybinding", "id": "UNLOAD", "category": "VEH_INTERACT", "name": "Unload fuel bunker", - "bindings": [ { "input_method": "keyboard", "key": "d" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "d" } ] }, { "type": "keybinding", "id": "REMOVE", "category": "VEH_INTERACT", "name": "Remove part", - "bindings": [ { "input_method": "keyboard", "key": "o" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "o" } ] }, { "type": "keybinding", "id": "RENAME", "category": "VEH_INTERACT", "name": "Rename vehicle", - "bindings": [ { "input_method": "keyboard", "key": "e" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "e" } ] }, { "type": "keybinding", "id": "SIPHON", "category": "VEH_INTERACT", "name": "Siphon from tank", - "bindings": [ { "input_method": "keyboard", "key": "s" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "s" } ] }, { "type": "keybinding", "id": "TIRE_CHANGE", "category": "VEH_INTERACT", "name": "Change tire", - "bindings": [ { "input_method": "keyboard", "key": "c" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "c" } ] }, { "type": "keybinding", "id": "ASSIGN_CREW", "category": "VEH_INTERACT", "name": "Assign crew", - "bindings": [ { "input_method": "keyboard", "key": "w" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "w" } ] }, { "type": "keybinding", "id": "RELABEL", "category": "VEH_INTERACT", "name": "Relabel a portion of a vehicle", - "bindings": [ { "input_method": "keyboard", "key": "a" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "a" } ] }, { "type": "keybinding", "id": "NEXT_TAB", "category": "VEH_INTERACT", "name": "Go to next tab", - "bindings": [ { "input_method": "keyboard", "key": "TAB" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "TAB" } ] }, { "type": "keybinding", "id": "PREV_TAB", "category": "VEH_INTERACT", "name": "Go to prev tab", - "bindings": [ { "input_method": "keyboard", "key": "BACKTAB" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "BACKTAB" }, + { "input_method": "keyboard_code", "key": "TAB", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "FUEL_LIST_UP", "category": "VEH_INTERACT", "name": "Scroll up through fuel list", - "bindings": [ { "input_method": "keyboard", "key": "[" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "[" } ] }, { "type": "keybinding", "id": "FUEL_LIST_DOWN", "category": "VEH_INTERACT", "name": "Scroll down through fuel list", - "bindings": [ { "input_method": "keyboard", "key": "]" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "]" } ] }, { "type": "keybinding", "id": "DESC_LIST_UP", "category": "VEH_INTERACT", "name": "Scroll up through vehicle part descriptions", - "bindings": [ { "input_method": "keyboard", "key": "<" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "<" }, { "input_method": "keyboard_code", "key": ",", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "DESC_LIST_DOWN", "category": "VEH_INTERACT", "name": "Scroll down through vehicle part descriptions", - "bindings": [ { "input_method": "keyboard", "key": ">" } ] + "bindings": [ { "input_method": "keyboard_char", "key": ">" }, { "input_method": "keyboard_code", "key": ".", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "OVERVIEW_UP", "category": "VEH_INTERACT", "name": "Scroll up through vehicle overview", - "bindings": [ { "input_method": "keyboard", "key": "{" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "{" }, { "input_method": "keyboard_code", "key": "[", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "OVERVIEW_DOWN", "category": "VEH_INTERACT", "name": "Scroll down through vehicle overview", - "bindings": [ { "input_method": "keyboard", "key": "}" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "}" }, { "input_method": "keyboard_code", "key": "]", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "TOGGLE_UNAVAILABLE_CONSTRUCTIONS", "category": "CONSTRUCTION", "name": "Toggle unavailable constructions", - "bindings": [ { "input_method": "keyboard", "key": ";" } ] + "bindings": [ { "input_method": "keyboard_any", "key": ";" } ] }, { "type": "keybinding", "id": "SCROLL_STAGE_UP", "category": "CONSTRUCTION", "name": "Scroll to previous stage", - "bindings": [ { "input_method": "keyboard", "key": "p" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "p" } ] }, { "type": "keybinding", "id": "SCROLL_STAGE_DOWN", "category": "CONSTRUCTION", "name": "Scroll to next stage", - "bindings": [ { "input_method": "keyboard", "key": "n" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "n" } ] }, { "type": "keybinding", "id": "EDITMAP_SHOW_ALL", "name": "Show all", - "bindings": [ { "input_method": "keyboard", "key": "v" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "v" } ] }, { "type": "keybinding", @@ -1309,9 +1469,9 @@ "category": "EDITMAP_FEATURE", "name": "Confirm & quit", "bindings": [ - { "input_method": "keyboard", "key": "e" }, - { "input_method": "keyboard", "key": "u" }, - { "input_method": "keyboard", "key": "t" } + { "input_method": "keyboard_any", "key": "e" }, + { "input_method": "keyboard_any", "key": "u" }, + { "input_method": "keyboard_any", "key": "t" } ] }, { @@ -1319,266 +1479,275 @@ "id": "RESIZE", "category": "EDITMAP_SHAPE", "name": "Resize", - "bindings": [ { "input_method": "keyboard", "key": "s" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "s" } ] }, { "type": "keybinding", "id": "START", "category": "EDITMAP_SHAPE", "name": "To start", - "bindings": [ { "input_method": "keyboard", "key": "z" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "z" } ] }, { "type": "keybinding", "id": "SWAP", "category": "EDITMAP_SHAPE", "name": "Swap origin and target", - "bindings": [ { "input_method": "keyboard", "key": "y" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "y" } ] }, { "type": "keybinding", "id": "EDITMAP_MOVE", "name": "Move shape", - "bindings": [ { "input_method": "keyboard", "key": "m" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "m" } ] }, { "type": "keybinding", "id": "EDITMAP_TAB", "name": "Switch to move point / confirm", - "bindings": [ { "input_method": "keyboard", "key": "TAB" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "TAB" } ] }, { "type": "keybinding", "id": "EDIT_TRAPS", "category": "EDITMAP", "name": "Edit traps", - "bindings": [ { "input_method": "keyboard", "key": "t" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "t" } ] }, { "type": "keybinding", "id": "EDIT_FIELDS", "category": "EDITMAP", "name": "Edit fields", - "bindings": [ { "input_method": "keyboard", "key": "f" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "f" } ] }, { "type": "keybinding", "id": "EDIT_TERRAIN", "category": "EDITMAP", "name": "Edit terrain", - "bindings": [ { "input_method": "keyboard", "key": "e" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "e" } ] }, { "type": "keybinding", "id": "EDIT_FURNITURE", "category": "EDITMAP", "name": "Edit furniture", - "bindings": [ { "input_method": "keyboard", "key": "r" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "r" } ] }, { "type": "keybinding", "id": "EDIT_OVERMAP", "category": "EDITMAP", "name": "Edit overmap / mapgen", - "bindings": [ { "input_method": "keyboard", "key": "o" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "o" } ] }, { "type": "keybinding", "id": "EDIT_ITEMS", "category": "EDITMAP", "name": "Edit items", - "bindings": [ { "input_method": "keyboard", "key": "i" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "i" } ] }, { "type": "keybinding", "id": "EDIT_MONSTER", "category": "EDITMAP", "name": "Edit creatures", - "bindings": [ { "input_method": "keyboard", "key": "m" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "m" } ] }, { "type": "keybinding", "id": "SHOW_ALL", "category": "EDITMAP", "name": "Show whole map", - "bindings": [ { "input_method": "keyboard", "key": "v" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "v" } ] }, { "type": "keybinding", "id": "LEFT_WIDE", "name": "Wide move left", - "bindings": [ { "input_method": "keyboard", "key": "H" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "H" }, { "input_method": "keyboard_code", "key": "h", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "RIGHT_WIDE", "name": "Wide move right", - "bindings": [ { "input_method": "keyboard", "key": "L" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "L" }, { "input_method": "keyboard_code", "key": "l", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "UP_WIDE", "name": "Wide move up", - "bindings": [ { "input_method": "keyboard", "key": "K" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "K" }, { "input_method": "keyboard_code", "key": "k", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "DOWN_WIDE", "name": "Wide move down", - "bindings": [ { "input_method": "keyboard", "key": "J" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "J" }, { "input_method": "keyboard_code", "key": "j", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "CATEGORY_SELECTION", "category": "INVENTORY", "name": "Toggle category selection mode", - "bindings": [ { "input_method": "keyboard", "key": "TAB" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "TAB" } ] }, { "type": "keybinding", "id": "VIEW_CATEGORY_MODE", "name": "Toggle inventory view to show item categories", - "bindings": [ { "input_method": "keyboard", "key": ";" } ] + "bindings": [ { "input_method": "keyboard_any", "key": ";" } ] }, { "type": "keybinding", "id": "INVENTORY_FILTER", "category": "INVENTORY", "name": "Set item filter", - "bindings": [ { "input_method": "keyboard", "key": "/" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "/" }, { "input_method": "keyboard_code", "key": "KEYPAD_DIVIDE" } ] }, { "type": "keybinding", "id": "TOGGLE_FAVORITE", "category": "INVENTORY", "name": "Toggle item as favorite", - "bindings": [ { "input_method": "keyboard", "key": "*" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "*" }, + { "input_method": "keyboard_code", "key": "KEYPAD_MULTIPLY" }, + { "input_method": "keyboard_code", "key": "8", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "TOGGLE_EXAMINE", "category": "BIONICS", "name": "Toggle activate/examine", - "bindings": [ { "input_method": "keyboard", "key": "!" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "!" }, { "input_method": "keyboard_code", "key": "1", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "TOGGLE_SAFE_FUEL", "category": "BIONICS", "name": "Toggle safe fuel mod", - "bindings": [ { "input_method": "keyboard", "key": "S" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "S" }, { "input_method": "keyboard_code", "key": "s", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "TOGGLE_AUTO_START", "category": "BIONICS", "name": "Toggle auto start mod", - "bindings": [ { "input_method": "keyboard", "key": "A" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "A" }, { "input_method": "keyboard_code", "key": "a", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "SORT", "category": "BIONICS", "name": "Sort bionics list", - "bindings": [ { "input_method": "keyboard", "key": "s" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "s" } ] }, { "type": "keybinding", "id": "TOGGLE_EXAMINE", "category": "MUTATIONS", "name": "Toggle activate/examine", - "bindings": [ { "input_method": "keyboard", "key": "!" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "!" }, { "input_method": "keyboard_code", "key": "1", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Pause", "category": "DEFAULTMODE", "id": "pause", - "bindings": [ { "input_method": "keyboard", "key": "." }, { "input_method": "keyboard", "key": "5" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "." }, + { "input_method": "keyboard_code", "key": "KEYPAD_PERIOD" }, + { "input_method": "keyboard_any", "key": "5" }, + { "input_method": "keyboard_code", "key": "KEYPAD_5" } + ] }, { "type": "keybinding", "name": "Toggle Map Memory", "category": "DEFAULTMODE", "id": "toggle_map_memory", - "bindings": [ { "input_method": "keyboard", "key": "{" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "{" }, { "input_method": "keyboard_code", "key": "[", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Center View", "category": "DEFAULTMODE", "id": "center", - "bindings": [ { "input_method": "keyboard", "key": ":" } ] + "bindings": [ { "input_method": "keyboard_char", "key": ":" }, { "input_method": "keyboard_code", "key": ";", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Move View North", "category": "DEFAULTMODE", "id": "shift_n", - "bindings": [ { "input_method": "keyboard", "key": "K" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "K" }, { "input_method": "keyboard_code", "key": "k", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Move View East", "category": "DEFAULTMODE", "id": "shift_e", - "bindings": [ { "input_method": "keyboard", "key": "L" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "L" }, { "input_method": "keyboard_code", "key": "l", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Move View South", "category": "DEFAULTMODE", "id": "shift_s", - "bindings": [ { "input_method": "keyboard", "key": "J" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "J" }, { "input_method": "keyboard_code", "key": "j", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Move View West", "category": "DEFAULTMODE", "id": "shift_w", - "bindings": [ { "input_method": "keyboard", "key": "H" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "H" }, { "input_method": "keyboard_code", "key": "h", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Open Door", "category": "DEFAULTMODE", "id": "open", - "bindings": [ { "input_method": "keyboard", "key": "o" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "o" } ] }, { "type": "keybinding", "name": "Close Door", "category": "DEFAULTMODE", "id": "close", - "bindings": [ { "input_method": "keyboard", "key": "c" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "c" } ] }, { "type": "keybinding", "name": "Smash Nearby Terrain", "category": "DEFAULTMODE", "id": "smash", - "bindings": [ { "input_method": "keyboard", "key": "s" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "s" } ] }, { "type": "keybinding", "name": "Examine Nearby Terrain", "category": "DEFAULTMODE", "id": "examine", - "bindings": [ { "input_method": "keyboard", "key": "e" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "e" } ] }, { "type": "keybinding", "name": "Advanced Inventory management", "category": "DEFAULTMODE", "id": "advinv", - "bindings": [ { "input_method": "keyboard", "key": "/" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "/" }, { "input_method": "keyboard_code", "key": "KEYPAD_DIVIDE" } ] }, { "type": "keybinding", "name": "Pick up Nearby Item(s)", "category": "DEFAULTMODE", "id": "pickup", - "bindings": [ { "input_method": "keyboard", "key": "g" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "g" } ] }, { "type": "keybinding", @@ -1591,42 +1760,42 @@ "name": "Grab something nearby", "category": "DEFAULTMODE", "id": "grab", - "bindings": [ { "input_method": "keyboard", "key": "G" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "G" }, { "input_method": "keyboard_code", "key": "g", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Haul items along the ground", "category": "DEFAULTMODE", "id": "haul", - "bindings": [ { "input_method": "keyboard", "key": "\\" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "\\" } ] }, { "type": "keybinding", "name": "Zone activities", "category": "DEFAULTMODE", "id": "loot", - "bindings": [ { "input_method": "keyboard", "key": "O" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "O" }, { "input_method": "keyboard_code", "key": "o", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Butcher", "category": "DEFAULTMODE", "id": "butcher", - "bindings": [ { "input_method": "keyboard", "key": "B" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "B" }, { "input_method": "keyboard_code", "key": "b", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Chat with NPC", "category": "DEFAULTMODE", "id": "chat", - "bindings": [ { "input_method": "keyboard", "key": "C" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "C" }, { "input_method": "keyboard_code", "key": "c", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Look Around", "category": "DEFAULTMODE", "id": "look", - "bindings": [ { "input_method": "keyboard", "key": ";" }, { "input_method": "keyboard", "key": "x" } ] + "bindings": [ { "input_method": "keyboard_any", "key": ";" }, { "input_method": "keyboard_any", "key": "x" } ] }, { "type": "keybinding", @@ -1639,77 +1808,77 @@ "name": "Peek Around Corners", "category": "DEFAULTMODE", "id": "peek", - "bindings": [ { "input_method": "keyboard", "key": "X" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "X" }, { "input_method": "keyboard_code", "key": "x", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "List all items around the player", "category": "DEFAULTMODE", "id": "listitems", - "bindings": [ { "input_method": "keyboard", "key": "V" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "V" }, { "input_method": "keyboard_code", "key": "v", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Manage zones", "category": "DEFAULTMODE", "id": "zones", - "bindings": [ { "input_method": "keyboard", "key": "Y" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "Y" }, { "input_method": "keyboard_code", "key": "y", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Open Inventory", "category": "DEFAULTMODE", "id": "inventory", - "bindings": [ { "input_method": "keyboard", "key": "i" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "i" } ] }, { "type": "keybinding", "name": "Compare two Items", "category": "DEFAULTMODE", "id": "compare", - "bindings": [ { "input_method": "keyboard", "key": "I" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "I" }, { "input_method": "keyboard_code", "key": "i", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Swap Inventory Letters", "category": "DEFAULTMODE", "id": "organize", - "bindings": [ { "input_method": "keyboard", "key": "=" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "=" } ] }, { "type": "keybinding", "name": "Apply or Use Item", "category": "DEFAULTMODE", "id": "apply", - "bindings": [ { "input_method": "keyboard", "key": "a" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "a" } ] }, { "type": "keybinding", "name": "Apply or Use Wielded Item", "category": "DEFAULTMODE", "id": "apply_wielded", - "bindings": [ { "input_method": "keyboard", "key": "A" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "A" }, { "input_method": "keyboard_code", "key": "a", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Wear Item", "category": "DEFAULTMODE", "id": "wear", - "bindings": [ { "input_method": "keyboard", "key": "W" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "W" }, { "input_method": "keyboard_code", "key": "w", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Take Off Worn Item", "category": "DEFAULTMODE", "id": "take_off", - "bindings": [ { "input_method": "keyboard", "key": "T" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "T" }, { "input_method": "keyboard_code", "key": "t", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Eat", "category": "DEFAULTMODE", "id": "eat", - "bindings": [ { "input_method": "keyboard", "key": "E" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "E" }, { "input_method": "keyboard_code", "key": "e", "mod": [ "shift" ] } ] }, { "type": "keybinding", @@ -1722,21 +1891,21 @@ "name": "Read", "category": "DEFAULTMODE", "id": "read", - "bindings": [ { "input_method": "keyboard", "key": "R" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "R" }, { "input_method": "keyboard_code", "key": "r", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Wield", "category": "DEFAULTMODE", "id": "wield", - "bindings": [ { "input_method": "keyboard", "key": "w" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "w" } ] }, { "type": "keybinding", "name": "Select Martial Arts Style", "category": "DEFAULTMODE", "id": "pick_style", - "bindings": [ { "input_method": "keyboard", "key": "_" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "_" }, { "input_method": "keyboard_code", "key": "-", "mod": [ "shift" ] } ] }, { "type": "keybinding", @@ -1755,112 +1924,120 @@ "name": "Unload or Empty Wielded Item", "category": "DEFAULTMODE", "id": "unload", - "bindings": [ { "input_method": "keyboard", "key": "U" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "U" }, { "input_method": "keyboard_code", "key": "u", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Throw Item", "category": "DEFAULTMODE", "id": "throw", - "bindings": [ { "input_method": "keyboard", "key": "t" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "t" } ] }, { "type": "keybinding", "name": "Blind Throw Item", "category": "LOOK", "id": "throw_blind", - "bindings": [ { "input_method": "keyboard", "key": "t" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "t" } ] }, { "type": "keybinding", "name": "Fire Wielded Item", "category": "DEFAULTMODE", "id": "fire", - "bindings": [ { "input_method": "keyboard", "key": "f" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "f" } ] }, { "type": "keybinding", "name": "Toggle attack mode of Wielded Item", "category": "DEFAULTMODE", "id": "select_fire_mode", - "bindings": [ { "input_method": "keyboard", "key": "F" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "F" }, { "input_method": "keyboard_code", "key": "f", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Drop Item", "category": "DEFAULTMODE", "id": "drop", - "bindings": [ { "input_method": "keyboard", "key": "d" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "d" } ] }, { "type": "keybinding", "name": "Drop Item to Adjacent Tile", "category": "DEFAULTMODE", "id": "drop_adj", - "bindings": [ { "input_method": "keyboard", "key": "D" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "D" }, { "input_method": "keyboard_code", "key": "d", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "View/Activate Bionics", "category": "DEFAULTMODE", "id": "bionics", - "bindings": [ { "input_method": "keyboard", "key": "p" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "p" } ] }, { "type": "keybinding", "name": "View/Activate Mutations", "category": "DEFAULTMODE", "id": "mutations", - "bindings": [ { "input_method": "keyboard", "key": "[" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "[" } ] }, { "type": "keybinding", "name": "Re-layer armor/clothing", "category": "DEFAULTMODE", "id": "sort_armor", - "bindings": [ { "input_method": "keyboard", "key": "+" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "+" }, + { "input_method": "keyboard_code", "key": "KEYPAD_PLUS" }, + { "input_method": "keyboard_code", "key": "=", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "name": "Wait for Several Minutes", "category": "DEFAULTMODE", "id": "wait", - "bindings": [ { "input_method": "keyboard", "key": "|" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "|" }, { "input_method": "keyboard_code", "key": "", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Craft Items", "category": "DEFAULTMODE", "id": "craft", - "bindings": [ { "input_method": "keyboard", "key": "&" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "&" }, { "input_method": "keyboard_code", "key": "7", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Recraft last recipe", "category": "DEFAULTMODE", "id": "recraft", - "bindings": [ { "input_method": "keyboard", "key": "-" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "-" }, { "input_method": "keyboard_code", "key": "KEYPAD_MINUS" } ] }, { "type": "keybinding", "name": "Construct Terrain", "category": "DEFAULTMODE", "id": "construct", - "bindings": [ { "input_method": "keyboard", "key": "*" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "*" }, + { "input_method": "keyboard_code", "key": "KEYPAD_MULTIPLY" }, + { "input_method": "keyboard_code", "key": "8", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "name": "Disassemble items", "category": "DEFAULTMODE", "id": "disassemble", - "bindings": [ { "input_method": "keyboard", "key": "(" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "(" }, { "input_method": "keyboard_code", "key": "9", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Sleep", "category": "DEFAULTMODE", "id": "sleep", - "bindings": [ { "input_method": "keyboard", "key": "$" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "$" }, { "input_method": "keyboard_code", "key": "4", "mod": [ "shift" ] } ] }, { "type": "keybinding", @@ -1873,7 +2050,7 @@ "name": "Control Vehicle", "category": "DEFAULTMODE", "id": "control_vehicle", - "bindings": [ { "input_method": "keyboard", "key": "^" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "^" }, { "input_method": "keyboard_code", "key": "6", "mod": [ "shift" ] } ] }, { "type": "keybinding", @@ -1886,49 +2063,49 @@ "name": "Toggle Safe Mode", "category": "DEFAULTMODE", "id": "safemode", - "bindings": [ { "input_method": "keyboard", "key": "!" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "!" }, { "input_method": "keyboard_code", "key": "1", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Ignore Nearby Enemy", "category": "DEFAULTMODE", "id": "ignore_enemy", - "bindings": [ { "input_method": "keyboard", "key": "'" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "'" } ] }, { "type": "keybinding", "name": "Whitelist enemy", "category": "DEFAULTMODE", "id": "whitelist_enemy", - "bindings": [ { "input_method": "keyboard", "key": "~" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "~" }, { "input_method": "keyboard_code", "key": "`", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Save and Quit", "category": "DEFAULTMODE", "id": "save", - "bindings": [ { "input_method": "keyboard", "key": "S" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "S" }, { "input_method": "keyboard_code", "key": "s", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Commit Suicide", "category": "DEFAULTMODE", "id": "SUICIDE", - "bindings": [ { "input_method": "keyboard", "key": "Q" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "Q" }, { "input_method": "keyboard_code", "key": "q", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "View Player Info", "category": "DEFAULTMODE", "id": "player_data", - "bindings": [ { "input_method": "keyboard", "key": "@" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "@" }, { "input_method": "keyboard_code", "key": "2", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "View Map", "category": "DEFAULTMODE", "id": "map", - "bindings": [ { "input_method": "keyboard", "key": "m" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "m" } ] }, { "type": "keybinding", @@ -1941,54 +2118,54 @@ "name": "View Missions", "category": "DEFAULTMODE", "id": "missions", - "bindings": [ { "input_method": "keyboard", "key": "M" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "M" }, { "input_method": "keyboard_code", "key": "m", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "View Factions", "category": "DEFAULTMODE", "id": "factions", - "bindings": [ { "input_method": "keyboard", "key": "#" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "#" }, { "input_method": "keyboard_code", "key": "3", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "View Achievements, Scores, and Kills", "category": "DEFAULTMODE", "id": "scores", - "bindings": [ { "input_method": "keyboard", "key": ")" } ] + "bindings": [ { "input_method": "keyboard_char", "key": ")" }, { "input_method": "keyboard_code", "key": "0", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "View Morale", "category": "DEFAULTMODE", "id": "morale", - "bindings": [ { "input_method": "keyboard", "key": "v" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "v" } ] }, { "type": "keybinding", "name": "View Message Log", "category": "DEFAULTMODE", "id": "messages", - "bindings": [ { "input_method": "keyboard", "key": "P" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "P" }, { "input_method": "keyboard_code", "key": "p", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "View Help", "category": "DEFAULTMODE", "id": "help", - "bindings": [ { "input_method": "keyboard", "key": "0" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "0" }, { "input_method": "keyboard_code", "key": "KEYPAD_0" } ] }, { "type": "keybinding", "name": "Zoom In", "id": "zoom_in", - "bindings": [ { "input_method": "keyboard", "key": "z" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "z" } ] }, { "type": "keybinding", "name": "Zoom Out", "id": "zoom_out", - "bindings": [ { "input_method": "keyboard", "key": "Z" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "Z" }, { "input_method": "keyboard_code", "key": "z", "mod": [ "shift" ] } ] }, { "type": "keybinding", @@ -2054,21 +2231,21 @@ "type": "keybinding", "name": "Toggle Minimap", "id": "toggle_pixel_minimap", - "bindings": [ { "input_method": "keyboard", "key": "N" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "N" }, { "input_method": "keyboard_code", "key": "n", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Toggle Panel Admin", "category": "DEFAULTMODE", "id": "toggle_panel_adm", - "bindings": [ { "input_method": "keyboard", "key": "}" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "}" }, { "input_method": "keyboard_code", "key": "]", "mod": [ "shift" ] } ] }, { "type": "keybinding", "name": "Reload Item", "category": "DEFAULTMODE", "id": "reload_item", - "bindings": [ { "input_method": "keyboard", "key": "r" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "r" } ] }, { "type": "keybinding", @@ -2111,14 +2288,14 @@ "name": "Action Menu", "category": "DEFAULTMODE", "id": "action_menu", - "bindings": [ { "input_method": "keyboard", "key": "RETURN" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "RETURN" }, { "input_method": "keyboard_code", "key": "KEYPAD_ENTER" } ] }, { "type": "keybinding", "name": "Item Action Menu", "category": "DEFAULTMODE", "id": "item_action_menu", - "bindings": [ { "input_method": "keyboard", "key": "%" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "%" }, { "input_method": "keyboard_code", "key": "5", "mod": [ "shift" ] } ] }, { "type": "keybinding", @@ -2179,14 +2356,14 @@ "name": "Autoattack", "category": "DEFAULTMODE", "id": "autoattack", - "bindings": [ { "input_method": "keyboard", "key": "TAB" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "TAB" } ] }, { "type": "keybinding", "name": "Main Menu", "category": "DEFAULTMODE", "id": "main_menu", - "bindings": [ { "input_method": "keyboard", "key": "ESC" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "ESC" } ] }, { "type": "keybinding", @@ -2253,7 +2430,10 @@ "name": "Movement Mode Menu", "category": "DEFAULTMODE", "id": "open_movement", - "bindings": [ { "input_method": "keyboard", "key": "\"" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "\"" }, + { "input_method": "keyboard_code", "key": "'", "mod": [ "shift" ] } + ] }, { "type": "keybinding", @@ -2267,9 +2447,11 @@ "category": "LIST_ITEMS", "name": "Compare", "bindings": [ - { "input_method": "keyboard", "key": "I" }, - { "input_method": "keyboard", "key": "c" }, - { "input_method": "keyboard", "key": "C" } + { "input_method": "keyboard_char", "key": "I" }, + { "input_method": "keyboard_code", "key": "i", "mod": [ "shift" ] }, + { "input_method": "keyboard_any", "key": "c" }, + { "input_method": "keyboard_char", "key": "C" }, + { "input_method": "keyboard_code", "key": "c", "mod": [ "shift" ] } ] }, { @@ -2277,70 +2459,82 @@ "id": "EXAMINE", "category": "LIST_ITEMS", "name": "Examine", - "bindings": [ { "input_method": "keyboard", "key": "e" }, { "input_method": "keyboard", "key": "E" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "e" }, + { "input_method": "keyboard_char", "key": "E" }, + { "input_method": "keyboard_code", "key": "e", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "PRIORITY_INCREASE", "category": "LIST_ITEMS", "name": "Increase priority", - "bindings": [ { "input_method": "keyboard", "key": "+" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "+" }, + { "input_method": "keyboard_code", "key": "KEYPAD_PLUS" }, + { "input_method": "keyboard_code", "key": "=", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "PRIORITY_DECREASE", "category": "LIST_ITEMS", "name": "Decrease priority", - "bindings": [ { "input_method": "keyboard", "key": "-" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "-" }, { "input_method": "keyboard_code", "key": "KEYPAD_MINUS" } ] }, { "type": "keybinding", "id": "SORT", "category": "LIST_ITEMS", "name": "Change sort order", - "bindings": [ { "input_method": "keyboard", "key": "s" }, { "input_method": "keyboard", "key": "S" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "s" }, + { "input_method": "keyboard_char", "key": "S" }, + { "input_method": "keyboard_code", "key": "s", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "SAFEMODE_BLACKLIST_ADD", "category": "LIST_MONSTERS", "name": "Add to safemode blacklist", - "bindings": [ { "input_method": "keyboard", "key": "a" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "a" } ] }, { "type": "keybinding", "id": "SAFEMODE_BLACKLIST_REMOVE", "category": "LIST_MONSTERS", "name": "Remove from safemode blacklist", - "bindings": [ { "input_method": "keyboard", "key": "r" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "r" } ] }, { "type": "keybinding", "id": "look", "category": "LIST_MONSTERS", "name": "look around", - "bindings": [ { "input_method": "keyboard", "key": "x" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "x" } ] }, { "type": "keybinding", "id": "fire", "category": "LIST_MONSTERS", "name": { "ctxt": "verb", "str": "fire" }, - "bindings": [ { "input_method": "keyboard", "key": "f" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "f" } ] }, { "type": "keybinding", "id": "LIST_ITEMS", "category": "LOOK", "name": "List items and monsters", - "bindings": [ { "input_method": "keyboard", "key": "V" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "V" }, { "input_method": "keyboard_code", "key": "v", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "REASSIGN", "category": "BIONICS", "name": "Reassign invlet", - "bindings": [ { "input_method": "keyboard", "key": "=" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "=" } ] }, { "type": "keybinding", @@ -2348,8 +2542,9 @@ "category": "BIONICS", "name": "Move cursor up", "bindings": [ - { "input_method": "keyboard", "key": "8" }, - { "input_method": "keyboard", "key": "UP" }, + { "input_method": "keyboard_any", "key": "8" }, + { "input_method": "keyboard_code", "key": "KEYPAD_8" }, + { "input_method": "keyboard_any", "key": "UP" }, { "input_method": "gamepad", "key": "JOY_UP" } ] }, @@ -2359,8 +2554,9 @@ "category": "BIONICS", "name": "Move cursor down", "bindings": [ - { "input_method": "keyboard", "key": "DOWN" }, - { "input_method": "keyboard", "key": "2" }, + { "input_method": "keyboard_any", "key": "DOWN" }, + { "input_method": "keyboard_any", "key": "2" }, + { "input_method": "keyboard_code", "key": "KEYPAD_2" }, { "input_method": "gamepad", "key": "JOY_DOWN" } ] }, @@ -2369,7 +2565,7 @@ "id": "REASSIGN", "category": "MUTATIONS", "name": "Reassign invlet", - "bindings": [ { "input_method": "keyboard", "key": "=" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "=" } ] }, { "type": "keybinding", @@ -2377,8 +2573,9 @@ "category": "MUTATIONS", "name": "Pan up", "bindings": [ - { "input_method": "keyboard", "key": "8" }, - { "input_method": "keyboard", "key": "UP" }, + { "input_method": "keyboard_any", "key": "8" }, + { "input_method": "keyboard_code", "key": "KEYPAD_8" }, + { "input_method": "keyboard_any", "key": "UP" }, { "input_method": "gamepad", "key": "JOY_UP" } ] }, @@ -2388,8 +2585,9 @@ "category": "MUTATIONS", "name": "Pan down", "bindings": [ - { "input_method": "keyboard", "key": "DOWN" }, - { "input_method": "keyboard", "key": "2" }, + { "input_method": "keyboard_any", "key": "DOWN" }, + { "input_method": "keyboard_any", "key": "2" }, + { "input_method": "keyboard_code", "key": "KEYPAD_2" }, { "input_method": "gamepad", "key": "JOY_DOWN" } ] }, @@ -2399,119 +2597,159 @@ "category": "HELP_KEYBINDINGS", "name": "Exit this keybinding screen", "//": "separate entry, because the global entry also has 'q', 'Q' and space listed, which conflicts with the search text input", - "bindings": [ { "input_method": "keyboard", "key": "ESC" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "ESC" } ] }, { "type": "keybinding", "id": "UP", "category": "HELP_KEYBINDINGS", "name": "Pan up", - "bindings": [ { "input_method": "keyboard", "key": "UP" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "UP" } ] }, { "type": "keybinding", "id": "DOWN", "category": "HELP_KEYBINDINGS", "name": "Pan down", - "bindings": [ { "input_method": "keyboard", "key": "DOWN" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "DOWN" } ] }, { "type": "keybinding", "id": "REMOVE", "category": "HELP_KEYBINDINGS", "name": "Remove bindings", - "bindings": [ { "input_method": "keyboard", "key": "-" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "-" }, { "input_method": "keyboard_code", "key": "KEYPAD_MINUS" } ] }, { "type": "keybinding", "id": "ADD_LOCAL", "category": "HELP_KEYBINDINGS", "name": "Add local keybinding", - "bindings": [ { "input_method": "keyboard", "key": "+" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "+" }, + { "input_method": "keyboard_code", "key": "KEYPAD_PLUS" }, + { "input_method": "keyboard_code", "key": "=", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "ADD_GLOBAL", "category": "HELP_KEYBINDINGS", "name": "Add global keybinding", - "bindings": [ { "input_method": "keyboard", "key": "=" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "=" } ] }, { "type": "keybinding", "id": "EXECUTE", "category": "HELP_KEYBINDINGS", "name": "Execute action keybinding", - "bindings": [ { "input_method": "keyboard", "key": "." } ] + "bindings": [ { "input_method": "keyboard_any", "key": "." }, { "input_method": "keyboard_code", "key": "KEYPAD_PERIOD" } ] }, { "type": "keybinding", "id": "ADD_ZONE", "category": "ZONES_MANAGER", "name": "Add zone", - "bindings": [ { "input_method": "keyboard", "key": "a" }, { "input_method": "keyboard", "key": "A" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "a" }, + { "input_method": "keyboard_char", "key": "A" }, + { "input_method": "keyboard_code", "key": "a", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "REMOVE_ZONE", "category": "ZONES_MANAGER", "name": "Remove zone", - "bindings": [ { "input_method": "keyboard", "key": "r" }, { "input_method": "keyboard", "key": "R" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "r" }, + { "input_method": "keyboard_char", "key": "R" }, + { "input_method": "keyboard_code", "key": "r", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "MOVE_ZONE_UP", "category": "ZONES_MANAGER", "name": "Move zone up", - "bindings": [ { "input_method": "keyboard", "key": "+" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "+" }, + { "input_method": "keyboard_code", "key": "KEYPAD_PLUS" }, + { "input_method": "keyboard_code", "key": "=", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "MOVE_ZONE_DOWN", "category": "ZONES_MANAGER", "name": "Move zone down", - "bindings": [ { "input_method": "keyboard", "key": "-" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "-" }, { "input_method": "keyboard_code", "key": "KEYPAD_MINUS" } ] }, { "type": "keybinding", "id": "SHOW_ZONE_ON_MAP", "category": "ZONES_MANAGER", "name": "Show zone on map", - "bindings": [ { "input_method": "keyboard", "key": "m" }, { "input_method": "keyboard", "key": "M" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "m" }, + { "input_method": "keyboard_char", "key": "M" }, + { "input_method": "keyboard_code", "key": "m", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "ENABLE_ZONE", "category": "ZONES_MANAGER", "name": "Enable zone", - "bindings": [ { "input_method": "keyboard", "key": "e" }, { "input_method": "keyboard", "key": "E" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "e" }, + { "input_method": "keyboard_char", "key": "E" }, + { "input_method": "keyboard_code", "key": "e", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "DISABLE_ZONE", "category": "ZONES_MANAGER", "name": "Disable zone", - "bindings": [ { "input_method": "keyboard", "key": "d" }, { "input_method": "keyboard", "key": "D" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "d" }, + { "input_method": "keyboard_char", "key": "D" }, + { "input_method": "keyboard_code", "key": "d", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "SHOW_ALL_ZONES", "category": "ZONES_MANAGER", "name": "Show all zones / hide distant zones", - "bindings": [ { "input_method": "keyboard", "key": "s" }, { "input_method": "keyboard", "key": "S" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "s" }, + { "input_method": "keyboard_char", "key": "S" }, + { "input_method": "keyboard_code", "key": "s", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "PAGE_DOWN", "category": "ADVANCED_INVENTORY", "name": "Page down", - "bindings": [ { "input_method": "keyboard", "key": "NPAGE" }, { "input_method": "keyboard", "key": ">" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "NPAGE" }, + { "input_method": "keyboard_char", "key": ">" }, + { "input_method": "keyboard_code", "key": ".", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "PAGE_UP", "category": "ADVANCED_INVENTORY", "name": "Page up", - "bindings": [ { "input_method": "keyboard", "key": "PPAGE" }, { "input_method": "keyboard", "key": "<" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "PPAGE" }, + { "input_method": "keyboard_char", "key": "<" }, + { "input_method": "keyboard_code", "key": ",", "mod": [ "shift" ] } + ] }, { "type": "keybinding", @@ -2519,8 +2757,8 @@ "category": "ADVANCED_INVENTORY", "name": "Pan up", "bindings": [ - { "input_method": "keyboard", "key": "k" }, - { "input_method": "keyboard", "key": "UP" }, + { "input_method": "keyboard_any", "key": "k" }, + { "input_method": "keyboard_any", "key": "UP" }, { "input_method": "gamepad", "key": "JOY_UP" } ] }, @@ -2530,8 +2768,8 @@ "category": "ADVANCED_INVENTORY", "name": "Pan down", "bindings": [ - { "input_method": "keyboard", "key": "j" }, - { "input_method": "keyboard", "key": "DOWN" }, + { "input_method": "keyboard_any", "key": "j" }, + { "input_method": "keyboard_any", "key": "DOWN" }, { "input_method": "gamepad", "key": "JOY_DOWN" } ] }, @@ -2541,8 +2779,8 @@ "category": "ADVANCED_INVENTORY", "name": "Select left inventory", "bindings": [ - { "input_method": "keyboard", "key": "h" }, - { "input_method": "keyboard", "key": "LEFT" }, + { "input_method": "keyboard_any", "key": "h" }, + { "input_method": "keyboard_any", "key": "LEFT" }, { "input_method": "gamepad", "key": "JOY_LEFT" } ] }, @@ -2552,8 +2790,8 @@ "category": "ADVANCED_INVENTORY", "name": "Select right inventory", "bindings": [ - { "input_method": "keyboard", "key": "l" }, - { "input_method": "keyboard", "key": "RIGHT" }, + { "input_method": "keyboard_any", "key": "l" }, + { "input_method": "keyboard_any", "key": "RIGHT" }, { "input_method": "gamepad", "key": "JOY_RIGHT" } ] }, @@ -2562,147 +2800,163 @@ "id": "TOGGLE_TAB", "category": "ADVANCED_INVENTORY", "name": "Toggle tab", - "bindings": [ { "input_method": "keyboard", "key": "TAB" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "TAB" } ] }, { "type": "keybinding", "id": "TOGGLE_VEH", "category": "ADVANCED_INVENTORY", "name": "Toggle vehicle", - "bindings": [ { "input_method": "keyboard", "key": "v" }, { "input_method": "keyboard", "key": "V" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "v" }, + { "input_method": "keyboard_char", "key": "V" }, + { "input_method": "keyboard_code", "key": "v", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "TOGGLE_AUTO_PICKUP", "category": "ADVANCED_INVENTORY", "name": "Toggle auto-pickup for item", - "bindings": [ { "input_method": "keyboard", "key": "p" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "p" } ] }, { "type": "keybinding", "id": "EXAMINE", "category": "ADVANCED_INVENTORY", "name": "Examine", - "bindings": [ { "input_method": "keyboard", "key": "e" }, { "input_method": "keyboard", "key": "E" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "e" }, + { "input_method": "keyboard_char", "key": "E" }, + { "input_method": "keyboard_code", "key": "e", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "SORT", "category": "ADVANCED_INVENTORY", "name": "Change sorting mode", - "bindings": [ { "input_method": "keyboard", "key": "s" }, { "input_method": "keyboard", "key": "S" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "s" }, + { "input_method": "keyboard_char", "key": "S" }, + { "input_method": "keyboard_code", "key": "s", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "MOVE_SINGLE_ITEM", "category": "ADVANCED_INVENTORY", "name": "Move a single item", - "bindings": [ { "input_method": "keyboard", "key": "RETURN" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "RETURN" }, { "input_method": "keyboard_code", "key": "KEYPAD_ENTER" } ] }, { "type": "keybinding", "id": "MOVE_VARIABLE_ITEM", "category": "ADVANCED_INVENTORY", "name": "Move an amount of item", - "bindings": [ { "input_method": "keyboard", "key": "m" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "m" } ] }, { "type": "keybinding", "id": "MOVE_ITEM_STACK", "category": "ADVANCED_INVENTORY", "name": "Move item stack", - "bindings": [ { "input_method": "keyboard", "key": "M" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "M" }, { "input_method": "keyboard_code", "key": "m", "mod": [ "shift" ] } ] }, { "type": "keybinding", "id": "MOVE_ALL_ITEMS", "category": "ADVANCED_INVENTORY", "name": "Move all items", - "bindings": [ { "input_method": "keyboard", "key": "," } ] + "bindings": [ { "input_method": "keyboard_any", "key": "," } ] }, { "type": "keybinding", "id": "CATEGORY_SELECTION", "category": "ADVANCED_INVENTORY", "name": "Toggle category selection mode", - "bindings": [ { "input_method": "keyboard", "key": "t" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "t" } ] }, { "type": "keybinding", "id": "TOGGLE_FAVORITE", "category": "ADVANCED_INVENTORY", "name": "Toggle item as favorite", - "bindings": [ { "input_method": "keyboard", "key": "*" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "*" }, + { "input_method": "keyboard_code", "key": "KEYPAD_MULTIPLY" }, + { "input_method": "keyboard_code", "key": "8", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "DROP_NON_FAVORITE", "category": "INVENTORY", "name": "Mark/unmark non-favorite items in multidrop menu", - "bindings": [ { "input_method": "keyboard", "key": "," } ] + "bindings": [ { "input_method": "keyboard_any", "key": "," } ] }, { "type": "keybinding", "id": "ITEMS_NW", "category": "ADVANCED_INVENTORY", "name": "Select items @ North-West", - "bindings": [ { "input_method": "keyboard", "key": "7" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "7" }, { "input_method": "keyboard_code", "key": "KEYPAD_7" } ] }, { "type": "keybinding", "id": "ITEMS_N", "category": "ADVANCED_INVENTORY", "name": "Select items @ North", - "bindings": [ { "input_method": "keyboard", "key": "8" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "8" }, { "input_method": "keyboard_code", "key": "KEYPAD_8" } ] }, { "type": "keybinding", "id": "ITEMS_NE", "category": "ADVANCED_INVENTORY", "name": "Select items @ North-East", - "bindings": [ { "input_method": "keyboard", "key": "9" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "9" }, { "input_method": "keyboard_code", "key": "KEYPAD_9" } ] }, { "type": "keybinding", "id": "ITEMS_W", "category": "ADVANCED_INVENTORY", "name": "Select items @ West", - "bindings": [ { "input_method": "keyboard", "key": "4" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "4" }, { "input_method": "keyboard_code", "key": "KEYPAD_4" } ] }, { "type": "keybinding", "id": "ITEMS_CE", "category": "ADVANCED_INVENTORY", "name": "Select items @ center", - "bindings": [ { "input_method": "keyboard", "key": "5" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "5" }, { "input_method": "keyboard_code", "key": "KEYPAD_5" } ] }, { "type": "keybinding", "id": "ITEMS_E", "category": "ADVANCED_INVENTORY", "name": "Select items @ East", - "bindings": [ { "input_method": "keyboard", "key": "6" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "6" }, { "input_method": "keyboard_code", "key": "KEYPAD_6" } ] }, { "type": "keybinding", "id": "ITEMS_SW", "category": "ADVANCED_INVENTORY", "name": "Select items @ South-West", - "bindings": [ { "input_method": "keyboard", "key": "1" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "1" }, { "input_method": "keyboard_code", "key": "KEYPAD_1" } ] }, { "type": "keybinding", "id": "ITEMS_S", "category": "ADVANCED_INVENTORY", "name": "Select items @ South", - "bindings": [ { "input_method": "keyboard", "key": "2" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "2" }, { "input_method": "keyboard_code", "key": "KEYPAD_2" } ] }, { "type": "keybinding", "id": "ITEMS_SE", "category": "ADVANCED_INVENTORY", "name": "Select items @ South-East", - "bindings": [ { "input_method": "keyboard", "key": "3" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "3" }, { "input_method": "keyboard_code", "key": "KEYPAD_3" } ] }, { "type": "keybinding", @@ -2710,9 +2964,11 @@ "category": "ADVANCED_INVENTORY", "name": "Select items in inventory", "bindings": [ - { "input_method": "keyboard", "key": "i" }, - { "input_method": "keyboard", "key": "I" }, - { "input_method": "keyboard", "key": "0" } + { "input_method": "keyboard_any", "key": "i" }, + { "input_method": "keyboard_char", "key": "I" }, + { "input_method": "keyboard_code", "key": "i", "mod": [ "shift" ] }, + { "input_method": "keyboard_any", "key": "0" }, + { "input_method": "keyboard_code", "key": "KEYPAD_0" } ] }, { @@ -2720,28 +2976,44 @@ "id": "ITEMS_AROUND", "category": "ADVANCED_INVENTORY", "name": "Select items @ all 9 fields", - "bindings": [ { "input_method": "keyboard", "key": "a" }, { "input_method": "keyboard", "key": "A" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "a" }, + { "input_method": "keyboard_char", "key": "A" }, + { "input_method": "keyboard_code", "key": "a", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "ITEMS_DRAGGED_CONTAINER", "category": "ADVANCED_INVENTORY", "name": "Select items in dragged container", - "bindings": [ { "input_method": "keyboard", "key": "d" }, { "input_method": "keyboard", "key": "D" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "d" }, + { "input_method": "keyboard_char", "key": "D" }, + { "input_method": "keyboard_code", "key": "d", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "ITEMS_CONTAINER", "category": "ADVANCED_INVENTORY", "name": "Select items in container", - "bindings": [ { "input_method": "keyboard", "key": "c" }, { "input_method": "keyboard", "key": "C" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "c" }, + { "input_method": "keyboard_char", "key": "C" }, + { "input_method": "keyboard_code", "key": "c", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "ITEMS_WORN", "category": "ADVANCED_INVENTORY", "name": "Select items currently worn", - "bindings": [ { "input_method": "keyboard", "key": "w" }, { "input_method": "keyboard", "key": "W" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "w" }, + { "input_method": "keyboard_char", "key": "W" }, + { "input_method": "keyboard_code", "key": "w", "mod": [ "shift" ] } + ] }, { "type": "keybinding", @@ -2774,74 +3046,86 @@ "id": "UP", "category": "ITEM_ACTIONS", "name": "Pan up", - "bindings": [ { "input_method": "keyboard", "key": "UP" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "UP" } ] }, { "type": "keybinding", "id": "DOWN", "category": "ITEM_ACTIONS", "name": "Pan down", - "bindings": [ { "input_method": "keyboard", "key": "DOWN" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "DOWN" } ] }, { "type": "keybinding", "id": "FILTER", "category": "ITEM_ACTIONS", "name": "Filter", - "bindings": [ { "input_method": "keyboard", "key": "/" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "/" }, { "input_method": "keyboard_code", "key": "KEYPAD_DIVIDE" } ] }, { "type": "keybinding", "id": "QUIT", "category": "ITEM_ACTIONS", "name": "Cancel menu", - "bindings": [ { "input_method": "keyboard", "key": "ESC" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "ESC" } ] }, { "type": "keybinding", "id": "repair_fabric", "category": "ITEM_ACTIONS", "name": "Sew", - "bindings": [ { "input_method": "keyboard", "key": "s" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "s" } ] }, { "type": "keybinding", "id": "repair_metal", "category": "ITEM_ACTIONS", - "bindings": [ { "input_method": "keyboard", "key": "w" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "w" } ] }, { "type": "keybinding", "id": "firestarter", "category": "ITEM_ACTIONS", - "bindings": [ { "input_method": "keyboard", "key": "f" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "f" } ] }, { "type": "keybinding", "id": "holster", "category": "ITEM_ACTIONS", - "bindings": [ { "input_method": "keyboard", "key": "h" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "h" } ] }, { "type": "keybinding", "id": "REMOVE_CUSTOM", "category": "COLORS", "name": "Remove custom color", - "bindings": [ { "input_method": "keyboard", "key": "r" }, { "input_method": "keyboard", "key": "R" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "r" }, + { "input_method": "keyboard_char", "key": "R" }, + { "input_method": "keyboard_code", "key": "r", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "LOAD_TEMPLATE", "category": "COLORS", "name": "Load color template", - "bindings": [ { "input_method": "keyboard", "key": "t" }, { "input_method": "keyboard", "key": "T" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "t" }, + { "input_method": "keyboard_char", "key": "T" }, + { "input_method": "keyboard_code", "key": "t", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "YES", "category": "YESNO", "name": "Yes", - "bindings": [ { "input_method": "keyboard", "key": "Y" }, { "input_method": "keyboard", "key": "y" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "Y" }, + { "input_method": "keyboard_code", "key": "y", "mod": [ "shift" ] }, + { "input_method": "keyboard_any", "key": "y" } + ] }, { "type": "keybinding", @@ -2849,9 +3133,10 @@ "category": "YESNO", "name": "No", "bindings": [ - { "input_method": "keyboard", "key": "N" }, - { "input_method": "keyboard", "key": "n" }, - { "input_method": "keyboard", "key": "ESC" } + { "input_method": "keyboard_char", "key": "N" }, + { "input_method": "keyboard_code", "key": "n", "mod": [ "shift" ] }, + { "input_method": "keyboard_any", "key": "n" }, + { "input_method": "keyboard_any", "key": "ESC" } ] }, { @@ -2859,14 +3144,22 @@ "id": "YES", "category": "YESNOQUIT", "name": "Yes", - "bindings": [ { "input_method": "keyboard", "key": "Y" }, { "input_method": "keyboard", "key": "y" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "Y" }, + { "input_method": "keyboard_code", "key": "y", "mod": [ "shift" ] }, + { "input_method": "keyboard_any", "key": "y" } + ] }, { "type": "keybinding", "id": "NO", "category": "YESNOQUIT", "name": "No", - "bindings": [ { "input_method": "keyboard", "key": "N" }, { "input_method": "keyboard", "key": "n" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "N" }, + { "input_method": "keyboard_code", "key": "n", "mod": [ "shift" ] }, + { "input_method": "keyboard_any", "key": "n" } + ] }, { "type": "keybinding", @@ -2874,9 +3167,10 @@ "category": "YESNOQUIT", "name": "Quit", "bindings": [ - { "input_method": "keyboard", "key": "Q" }, - { "input_method": "keyboard", "key": "q" }, - { "input_method": "keyboard", "key": "ESC" } + { "input_method": "keyboard_char", "key": "Q" }, + { "input_method": "keyboard_code", "key": "q", "mod": [ "shift" ] }, + { "input_method": "keyboard_any", "key": "q" }, + { "input_method": "keyboard_any", "key": "ESC" } ] }, { @@ -2884,7 +3178,11 @@ "id": "YES", "category": "CANCEL_ACTIVITY_OR_IGNORE_QUERY", "name": "Yes", - "bindings": [ { "input_method": "keyboard", "key": "Y" }, { "input_method": "keyboard", "key": "y" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "Y" }, + { "input_method": "keyboard_code", "key": "y", "mod": [ "shift" ] }, + { "input_method": "keyboard_any", "key": "y" } + ] }, { "type": "keybinding", @@ -2892,9 +3190,10 @@ "category": "CANCEL_ACTIVITY_OR_IGNORE_QUERY", "name": "No", "bindings": [ - { "input_method": "keyboard", "key": "N" }, - { "input_method": "keyboard", "key": "n" }, - { "input_method": "keyboard", "key": "ESC" } + { "input_method": "keyboard_char", "key": "N" }, + { "input_method": "keyboard_code", "key": "n", "mod": [ "shift" ] }, + { "input_method": "keyboard_any", "key": "n" }, + { "input_method": "keyboard_any", "key": "ESC" } ] }, { @@ -2902,14 +3201,22 @@ "id": "IGNORE", "category": "CANCEL_ACTIVITY_OR_IGNORE_QUERY", "name": "Ignore further distractions and finish", - "bindings": [ { "input_method": "keyboard", "key": "I" }, { "input_method": "keyboard", "key": "i" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "I" }, + { "input_method": "keyboard_code", "key": "i", "mod": [ "shift" ] }, + { "input_method": "keyboard_any", "key": "i" } + ] }, { "type": "keybinding", "id": "YES", "category": "YES_NO_ALWAYS_NEVER", "name": "Yes", - "bindings": [ { "input_method": "keyboard", "key": [ "Y" ] }, { "input_method": "keyboard", "key": [ "y" ] } ] + "bindings": [ + { "input_method": "keyboard_char", "key": [ "Y" ] }, + { "input_method": "keyboard_code", "key": [ "y" ], "mod": [ "shift" ] }, + { "input_method": "keyboard_any", "key": [ "y" ] } + ] }, { "type": "keybinding", @@ -2917,9 +3224,10 @@ "category": "YES_NO_ALWAYS_NEVER", "name": "No", "bindings": [ - { "input_method": "keyboard", "key": [ "N" ] }, - { "input_method": "keyboard", "key": [ "n" ] }, - { "input_method": "keyboard", "key": [ "ESC" ] } + { "input_method": "keyboard_char", "key": [ "N" ] }, + { "input_method": "keyboard_code", "key": [ "n" ], "mod": [ "shift" ] }, + { "input_method": "keyboard_any", "key": [ "n" ] }, + { "input_method": "keyboard_any", "key": [ "ESC" ] } ] }, { @@ -2927,14 +3235,22 @@ "id": "ALWAYS", "category": "YES_NO_ALWAYS_NEVER", "name": "Always", - "bindings": [ { "input_method": "keyboard", "key": [ "A" ] }, { "input_method": "keyboard", "key": [ "a" ] } ] + "bindings": [ + { "input_method": "keyboard_char", "key": [ "A" ] }, + { "input_method": "keyboard_code", "key": [ "a" ], "mod": [ "shift" ] }, + { "input_method": "keyboard_any", "key": [ "a" ] } + ] }, { "type": "keybinding", "id": "NEVER", "category": "YES_NO_ALWAYS_NEVER", "name": "Never", - "bindings": [ { "input_method": "keyboard", "key": [ "E" ] }, { "input_method": "keyboard", "key": [ "e" ] } ] + "bindings": [ + { "input_method": "keyboard_char", "key": [ "E" ] }, + { "input_method": "keyboard_code", "key": [ "e" ], "mod": [ "shift" ] }, + { "input_method": "keyboard_any", "key": [ "e" ] } + ] }, { "type": "keybinding", @@ -2942,9 +3258,10 @@ "category": "POPUP_WAIT", "name": "Cancel popup", "bindings": [ - { "input_method": "keyboard", "key": "ESC" }, - { "input_method": "keyboard", "key": "SPACE" }, - { "input_method": "keyboard", "key": "RETURN" } + { "input_method": "keyboard_any", "key": "ESC" }, + { "input_method": "keyboard_any", "key": "SPACE" }, + { "input_method": "keyboard_any", "key": "RETURN" }, + { "input_method": "keyboard_code", "key": "KEYPAD_ENTER" } ] }, { @@ -2952,61 +3269,73 @@ "id": "CREATURE", "category": "EXTENDED_DESCRIPTION", "name": "Describe creature", - "bindings": [ { "input_method": "keyboard", "key": "c" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "c" } ] }, { "type": "keybinding", "id": "FURNITURE", "category": "EXTENDED_DESCRIPTION", "name": "Describe furniture", - "bindings": [ { "input_method": "keyboard", "key": "f" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "f" } ] }, { "type": "keybinding", "id": "TERRAIN", "category": "EXTENDED_DESCRIPTION", "name": "Describe terrain", - "bindings": [ { "input_method": "keyboard", "key": "t" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "t" } ] }, { "type": "keybinding", "id": "SWITCH_LISTS", "category": "NPC_TRADE", "name": "Switch lists", - "bindings": [ { "input_method": "keyboard", "key": "TAB" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "TAB" } ] }, { "type": "keybinding", "id": "PAGE_UP", "category": "NPC_TRADE", "name": "Back", - "bindings": [ { "input_method": "keyboard", "key": "PPAGE" }, { "input_method": "keyboard", "key": "<" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "PPAGE" }, + { "input_method": "keyboard_char", "key": "<" }, + { "input_method": "keyboard_code", "key": ",", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "PAGE_DOWN", "category": "NPC_TRADE", "name": "More", - "bindings": [ { "input_method": "keyboard", "key": "NPAGE" }, { "input_method": "keyboard", "key": ">" } ] + "bindings": [ + { "input_method": "keyboard_any", "key": "NPAGE" }, + { "input_method": "keyboard_char", "key": ">" }, + { "input_method": "keyboard_code", "key": ".", "mod": [ "shift" ] } + ] }, { "type": "keybinding", "id": "EXAMINE", "category": "NPC_TRADE", "name": "Examine item", - "bindings": [ { "input_method": "keyboard", "key": "/" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "/" }, { "input_method": "keyboard_code", "key": "KEYPAD_DIVIDE" } ] }, { "type": "keybinding", "id": "QUIT", "category": "NPC_TRADE", "name": "Cancel trading", - "bindings": [ { "input_method": "keyboard", "key": "ESC" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "ESC" } ] }, { "type": "keybinding", "id": "CHANGE_PROFESSION_NAME", "name": "Change profession name", - "bindings": [ { "input_method": "keyboard", "key": "*" } ] + "bindings": [ + { "input_method": "keyboard_char", "key": "*" }, + { "input_method": "keyboard_code", "key": "KEYPAD_MULTIPLY" }, + { "input_method": "keyboard_code", "key": "8", "mod": [ "shift" ] } + ] } ] diff --git a/data/raw/keybindings/vehicle.json b/data/raw/keybindings/vehicle.json index 433cefb64acbc..98daac94c76d3 100644 --- a/data/raw/keybindings/vehicle.json +++ b/data/raw/keybindings/vehicle.json @@ -4,265 +4,265 @@ "type": "keybinding", "category": "VEHICLE", "name": "Control multiple electronics", - "bindings": [ { "input_method": "keyboard", "key": "E" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "E" }, { "input_method": "keyboard_code", "key": "e", "mod": [ "shift" ] } ] }, { "id": "CONTROL_ENGINES", "type": "keybinding", "category": "VEHICLE", "name": "Control individual engines", - "bindings": [ { "input_method": "keyboard", "key": "y" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "y" } ] }, { "id": "FOLD_VEHICLE", "type": "keybinding", "category": "VEHICLE", "name": "Fold vehicle", - "bindings": [ { "input_method": "keyboard", "key": "f" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "f" } ] }, { "id": "RELEASE_CONTROLS", "type": "keybinding", "category": "VEHICLE", "name": "Release controls", - "bindings": [ { "input_method": "keyboard", "key": "l" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "l" } ] }, { "id": "SOUND_HORN", "type": "keybinding", "category": "VEHICLE", "name": "Sound horn", - "bindings": [ { "input_method": "keyboard", "key": "n" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "n" } ] }, { "id": "TOGGLE_AISLE_LIGHT", "type": "keybinding", "category": "VEHICLE", "name": "Toggle aisle lights", - "bindings": [ { "input_method": "keyboard", "key": "L" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "L" }, { "input_method": "keyboard_code", "key": "l", "mod": [ "shift" ] } ] }, { "id": "TOGGLE_ALARM", "type": "keybinding", "category": "VEHICLE", "name": "Toggle alarm", - "bindings": [ { "input_method": "keyboard", "key": "z" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "z" } ] }, { "id": "TOGGLE_ATOMIC_LIGHT", "type": "keybinding", "category": "VEHICLE", "name": "Toggle atomic lights", - "bindings": [ { "input_method": "keyboard", "key": "A" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "A" }, { "input_method": "keyboard_code", "key": "a", "mod": [ "shift" ] } ] }, { "id": "CONTROL_AUTOPILOT", "type": "keybinding", "category": "VEHICLE", "name": "Control autopilot", - "bindings": [ { "input_method": "keyboard", "key": "a" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "a" } ] }, { "id": "TOGGLE_CAMERA", "type": "keybinding", "category": "VEHICLE", "name": "Toggle camera system", - "bindings": [ { "input_method": "keyboard", "key": "M" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "M" }, { "input_method": "keyboard_code", "key": "m", "mod": [ "shift" ] } ] }, { "id": "TOGGLE_CHIMES", "type": "keybinding", "category": "VEHICLE", "name": "Toggle chimes", - "bindings": [ { "input_method": "keyboard", "key": "i" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "i" } ] }, { "id": "TOGGLE_CRUISE_CONTROL", "type": "keybinding", "category": "VEHICLE", "name": "Toggle cruise control", - "bindings": [ { "input_method": "keyboard", "key": "c" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "c" } ] }, { "id": "TOGGLE_DOME_LIGHT", "type": "keybinding", "category": "VEHICLE", "name": "Toggle dome lights", - "bindings": [ { "input_method": "keyboard", "key": "d" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "d" } ] }, { "id": "TOGGLE_DOORS", "type": "keybinding", "category": "VEHICLE", "name": "Toggle doors", - "bindings": [ { "input_method": "keyboard", "key": "D" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "D" }, { "input_method": "keyboard_code", "key": "d", "mod": [ "shift" ] } ] }, { "id": "TOGGLE_ENGINE", "type": "keybinding", "category": "VEHICLE", "name": "Toggle engine", - "bindings": [ { "input_method": "keyboard", "key": "e" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "e" } ] }, { "id": "TOGGLE_FRIDGE", "type": "keybinding", "category": "VEHICLE", "name": "Toggle fridge", - "bindings": [ { "input_method": "keyboard", "key": "f" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "f" } ] }, { "id": "TOGGLE_FREEZER", "type": "keybinding", "category": "VEHICLE", "name": "Toggle freezer", - "bindings": [ { "input_method": "keyboard", "key": "r" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "r" } ] }, { "id": "TOGGLE_SPACE_HEATER", "type": "keybinding", "category": "VEHICLE", "name": "Toggle space heater", - "bindings": [ { "input_method": "keyboard", "key": "s" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "s" } ] }, { "id": "TOGGLE_COOLER", "type": "keybinding", "category": "VEHICLE", "name": "Toggle cooler", - "bindings": [ { "input_method": "keyboard", "key": "C" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "C" }, { "input_method": "keyboard_code", "key": "c", "mod": [ "shift" ] } ] }, { "id": "TOGGLE_HEADLIGHT", "type": "keybinding", "category": "VEHICLE", "name": "Toggle headlights", - "bindings": [ { "input_method": "keyboard", "key": "h" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "h" } ] }, { "id": "TOGGLE_WIDE_HEADLIGHT", "type": "keybinding", "category": "VEHICLE", "name": "Toggle wide-angle headlights", - "bindings": [ { "input_method": "keyboard", "key": "b" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "b" } ] }, { "id": "TOGGLE_HALF_OVERHEAD_LIGHT", "type": "keybinding", "category": "VEHICLE", "name": "Toggle directional overhead lights", - "bindings": [ { "input_method": "keyboard", "key": "O" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "O" }, { "input_method": "keyboard_code", "key": "o", "mod": [ "shift" ] } ] }, { "id": "TOGGLE_OVERHEAD_LIGHT", "type": "keybinding", "category": "VEHICLE", "name": "Toggle overhead lights", - "bindings": [ { "input_method": "keyboard", "key": "o" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "o" } ] }, { "id": "TOGGLE_PLANTER", "type": "keybinding", "category": "VEHICLE", "name": "Toggle planter", - "bindings": [ { "input_method": "keyboard", "key": "P" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "P" }, { "input_method": "keyboard_code", "key": "p", "mod": [ "shift" ] } ] }, { "id": "TOGGLE_PLOW", "type": "keybinding", "category": "VEHICLE", "name": "Toggle plow", - "bindings": [ { "input_method": "keyboard", "key": "w" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "w" } ] }, { "id": "TOGGLE_REACTOR", "type": "keybinding", "category": "VEHICLE", "name": "Toggle reactor", - "bindings": [ { "input_method": "keyboard", "key": "k" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "k" } ] }, { "id": "TOGGLE_REAPER", "type": "keybinding", "category": "VEHICLE", "name": "Toggle reaper", - "bindings": [ { "input_method": "keyboard", "key": "H" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "H" }, { "input_method": "keyboard_code", "key": "h", "mod": [ "shift" ] } ] }, { "id": "TOGGLE_RECHARGER", "type": "keybinding", "category": "VEHICLE", "name": "Toggle recharger", - "bindings": [ { "input_method": "keyboard", "key": "g" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "g" } ] }, { "id": "TOGGLE_SCOOP", "type": "keybinding", "category": "VEHICLE", "name": "Toggle scoop", - "bindings": [ { "input_method": "keyboard", "key": "S" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "S" }, { "input_method": "keyboard_code", "key": "s", "mod": [ "shift" ] } ] }, { "id": "TOGGLE_STEREO", "type": "keybinding", "category": "VEHICLE", "name": "Toggle stereo", - "bindings": [ { "input_method": "keyboard", "key": "m" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "m" } ] }, { "id": "TOGGLE_WATER_PURIFIER", "type": "keybinding", "category": "VEHICLE", "name": "Toggle water purifiers", - "bindings": [ { "input_method": "keyboard", "key": "p" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "p" } ] }, { "id": "TOGGLE_TRACKING", "type": "keybinding", "category": "VEHICLE", "name": "Toggle tracking", - "bindings": [ { "input_method": "keyboard", "key": "K" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "K" }, { "input_method": "keyboard_code", "key": "k", "mod": [ "shift" ] } ] }, { "id": "TOGGLE_SMART_ENGINE_CONTROLLER", "type": "keybinding", "category": "VEHICLE", "name": "Toggle smart engine controller", - "bindings": [ { "input_method": "keyboard", "key": "Y" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "Y" }, { "input_method": "keyboard_code", "key": "y", "mod": [ "shift" ] } ] }, { "id": "TURRET_FIRE_MODE", "type": "keybinding", "category": "VEHICLE", "name": "Set turret firing modes", - "bindings": [ { "input_method": "keyboard", "key": "x" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "x" } ] }, { "id": "TURRET_MANUAL_AIM", "type": "keybinding", "category": "VEHICLE", "name": "Aim turrets manually", - "bindings": [ { "input_method": "keyboard", "key": "X" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "X" }, { "input_method": "keyboard_code", "key": "x", "mod": [ "shift" ] } ] }, { "id": "TURRET_MANUAL_OVERRIDE", "type": "keybinding", "category": "VEHICLE", "name": "Aim automatic turrets", - "bindings": [ { "input_method": "keyboard", "key": "V" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "V" }, { "input_method": "keyboard_code", "key": "v", "mod": [ "shift" ] } ] }, { "id": "TURRET_SINGLE_FIRE", "type": "keybinding", "category": "VEHICLE", "name": "Aim individual turret", - "bindings": [ { "input_method": "keyboard", "key": "T" } ] + "bindings": [ { "input_method": "keyboard_char", "key": "T" }, { "input_method": "keyboard_code", "key": "t", "mod": [ "shift" ] } ] }, { "id": "TURRET_TARGET_MODE", "type": "keybinding", "category": "VEHICLE", "name": "Set turret targeting modes", - "bindings": [ { "input_method": "keyboard", "key": "t" } ] + "bindings": [ { "input_method": "keyboard_any", "key": "t" } ] } ] diff --git a/src/action.cpp b/src/action.cpp index 5738a3c529d94..1713d19c3600b 100644 --- a/src/action.cpp +++ b/src/action.cpp @@ -120,7 +120,7 @@ std::vector keys_bound_to( action_id act, const bool restrict_to_printable action_id action_from_key( char ch ) { input_context ctxt = get_default_mode_input_context(); - const input_event event( ch, input_event_t::keyboard ); + const input_event event( ch, input_event_t::keyboard_char ); const std::string &action = ctxt.input_to_action( event ); return look_up_action( action ); } @@ -1025,7 +1025,7 @@ action_id handle_main_menu() cata::optional choose_direction( const std::string &message, const bool allow_vertical ) { - input_context ctxt( "DEFAULTMODE" ); + input_context ctxt( "DEFAULTMODE", keyboard_mode::keychar ); ctxt.set_iso( true ); ctxt.register_directions(); ctxt.register_action( "pause" ); diff --git a/src/advanced_inv.cpp b/src/advanced_inv.cpp index a2afb370d1029..c6c7ee66f12bb 100644 --- a/src/advanced_inv.cpp +++ b/src/advanced_inv.cpp @@ -25,7 +25,6 @@ #include "enums.h" #include "game.h" #include "game_constants.h" -#include "ime.h" #include "input.h" #include "inventory.h" #include "item.h" @@ -1594,8 +1593,6 @@ void advanced_inventory::display() ui->mark_resize(); } - ime_sentry sentry; - do { if( ui ) { ui_manager::redraw(); diff --git a/src/bionics_ui.cpp b/src/bionics_ui.cpp index f82a6eb77ad88..79748b5327105 100644 --- a/src/bionics_ui.cpp +++ b/src/bionics_ui.cpp @@ -183,7 +183,7 @@ char get_free_invlet( player &p ) static void draw_bionics_titlebar( const catacurses::window &window, player *p, bionic_menu_mode mode ) { - input_context ctxt( "BIONICS" ); + input_context ctxt( "BIONICS", keyboard_mode::keychar ); werase( window ); std::string fuel_string; @@ -611,7 +611,7 @@ void player::power_bionics() bionic_menu_mode menu_mode = ACTIVATING; int max_scroll_position = 0; - input_context ctxt( "BIONICS" ); + input_context ctxt( "BIONICS", keyboard_mode::keychar ); ctxt.register_updown(); ctxt.register_action( "ANY_INPUT" ); ctxt.register_action( "TOGGLE_EXAMINE" ); diff --git a/src/computer_session.cpp b/src/computer_session.cpp index 6538680dde373..f49eea2cebd8a 100644 --- a/src/computer_session.cpp +++ b/src/computer_session.cpp @@ -1572,7 +1572,7 @@ computer_session::ynq computer_session::query_ynq( const std::string &text, Args const bool force_uc = get_option( "FORCE_CAPITAL_YN" ); const auto &allow_key = force_uc ? input_context::disallow_lower_case : input_context::allow_all_keys; - input_context ctxt( "YESNOQUIT" ); + input_context ctxt( "YESNOQUIT", keyboard_mode::keychar ); ctxt.register_action( "YES" ); ctxt.register_action( "NO" ); ctxt.register_action( "QUIT" ); diff --git a/src/debug.cpp b/src/debug.cpp index 1bcca7b5e61d8..304e3ee117f65 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -189,7 +189,7 @@ void realDebugmsg( const char *filename, const char *line, const char *funcname, } ); #if defined(__ANDROID__) - input_context ctxt( "DEBUG_MSG" ); + input_context ctxt( "DEBUG_MSG", keyboard_mode::keychar ); ctxt.register_manual_key( 'C' ); ctxt.register_manual_key( 'I' ); ctxt.register_manual_key( ' ' ); diff --git a/src/editmap.cpp b/src/editmap.cpp index ad08cffa71c2f..afbc51674b5f7 100644 --- a/src/editmap.cpp +++ b/src/editmap.cpp @@ -1130,7 +1130,7 @@ void editmap::edit_feature() draw_target_override = nullptr; } - input_context ctxt( emenu.input_category ); + input_context ctxt( emenu.input_category, keyboard_mode::keychar ); info_txt_curr = string_format( pgettext( "keybinding descriptions", "%s, %s, %s, %s, %s" ), ctxt.describe_key_and_name( "CONFIRM" ), ctxt.describe_key_and_name( "CONFIRM_QUIT" ), @@ -1247,7 +1247,7 @@ void editmap::edit_fld() draw_target_override = nullptr; } - input_context ctxt( fmenu.input_category ); + input_context ctxt( fmenu.input_category, keyboard_mode::keychar ); // \u00A0 is the non-breaking space info_txt_curr = string_format( pgettext( "keybinding descriptions", "%s, %s, [%s,%s]\u00A0intensity, %s, %s, %s" ), @@ -1842,7 +1842,7 @@ void editmap::mapgen_preview( const real_coords &tc, uilist &gmenu ) } else { tmpmap_ptr = nullptr; } - input_context ctxt( gpmenu.input_category ); + input_context ctxt( gpmenu.input_category, keyboard_mode::keychar ); // \u00A0 is the non-breaking space info_txt_curr = string_format( pgettext( "keybinding descriptions", "[%s,%s]\u00A0prev/next oter type, [%s,%s]\u00A0select, %s, %s" ), @@ -2110,7 +2110,7 @@ void editmap::edit_mapgen() blink = true; - input_context ctxt( gmenu.input_category ); + input_context ctxt( gmenu.input_category, keyboard_mode::keychar ); info_txt_curr = string_format( pgettext( "keybinding descriptions", "%s, %s, %s" ), ctxt.describe_key_and_name( "EDITMAP_MOVE" ), ctxt.describe_key_and_name( "CONFIRM" ), diff --git a/src/game.cpp b/src/game.cpp index f3c5f2cba04d3..ca86a3a462213 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1718,6 +1718,7 @@ bool game::cancel_activity_or_ignore_query( const distraction_type type, const s : input_context::allow_all_keys; const auto &action = query_popup() + .preferred_keyboard_mode( keyboard_mode::keychar ) .context( "CANCEL_ACTIVITY_OR_IGNORE_QUERY" ) .message( force_uc ? pgettext( "cancel_activity_or_ignore_query", @@ -2493,7 +2494,7 @@ tripoint game::mouse_edge_scrolling_overmap( input_context &ctxt ) input_context get_default_mode_input_context() { - input_context ctxt( "DEFAULTMODE" ); + input_context ctxt( "DEFAULTMODE", keyboard_mode::keychar ); // Because those keys move the character, they don't pan, as their original name says ctxt.set_iso( true ); ctxt.register_action( "UP", to_translation( "Move North" ) ); diff --git a/src/handle_action.cpp b/src/handle_action.cpp index d875db782cea8..74e6f11826b7e 100644 --- a/src/handle_action.cpp +++ b/src/handle_action.cpp @@ -169,7 +169,7 @@ input_context game::get_player_input( std::string &action ) { input_context ctxt; if( uquit == QUIT_WATCH ) { - ctxt = input_context( "DEFAULTMODE" ); + ctxt = input_context( "DEFAULTMODE", keyboard_mode::keychar ); ctxt.set_iso( true ); // The list of allowed actions in death-cam mode in game::handle_action // *INDENT-OFF* diff --git a/src/help.cpp b/src/help.cpp index 302fa6b393d03..03e1b562e2a00 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -150,6 +150,7 @@ void help::display_help() init_windows( ui ); ui.on_screen_resize( init_windows ); + ctxt = input_context( "default", keyboard_mode::keychar ); ctxt.register_cardinal(); ctxt.register_action( "QUIT" ); ctxt.register_action( "CONFIRM" ); diff --git a/src/ime.cpp b/src/ime.cpp deleted file mode 100644 index 91217bc808568..0000000000000 --- a/src/ime.cpp +++ /dev/null @@ -1,159 +0,0 @@ -#include "ime.h" - -#ifdef __ANDROID__ -#include "options.h" -#include "sdltiles.h" -#endif - -#ifdef _WIN32 - -#if 1 // Prevent IWYU reordering this below -#include "platform_win.h" -#endif -#include - -class imm_wrapper -{ - private: - HMODULE hImm; - using pImmGetContext_t = HIMC( WINAPI * )( HWND ); - using pImmGetOpenStatus_t = BOOL( WINAPI * )( HIMC ); - using pImmSetOpenStatus_t = BOOL( WINAPI * )( HIMC, BOOL ); - using pImmReleaseContext_t = BOOL( WINAPI * )( HWND, HIMC ); - pImmGetContext_t pImmGetContext; - pImmGetOpenStatus_t pImmGetOpenStatus; - pImmSetOpenStatus_t pImmSetOpenStatus; - pImmReleaseContext_t pImmReleaseContext; - - template - static T fun_ptr_cast( FARPROC p ) { - // workaround function cast warning - return reinterpret_cast( reinterpret_cast( p ) ); - } - public: - imm_wrapper() { - // Check if East Asian support is available - hImm = LoadLibrary( "imm32.dll" ); - if( hImm ) { - pImmGetContext = fun_ptr_cast( - GetProcAddress( hImm, "ImmGetContext" ) ); - pImmGetOpenStatus = fun_ptr_cast( - GetProcAddress( hImm, "ImmGetOpenStatus" ) ); - pImmSetOpenStatus = fun_ptr_cast( - GetProcAddress( hImm, "ImmSetOpenStatus" ) ); - pImmReleaseContext = fun_ptr_cast( - GetProcAddress( hImm, "ImmReleaseContext" ) ); - if( !pImmGetContext || !pImmGetOpenStatus || - !pImmSetOpenStatus || !pImmReleaseContext ) { - - FreeLibrary( hImm ); - hImm = nullptr; - pImmGetContext = nullptr; - pImmGetOpenStatus = nullptr; - pImmSetOpenStatus = nullptr; - pImmReleaseContext = nullptr; - } - } - } - - ~imm_wrapper() { - if( hImm ) { - FreeLibrary( hImm ); - } - } - - bool ime_enabled() { - if( hImm ) { - // NOLINTNEXTLINE(misc-misplaced-const) - const HWND hwnd = getWindowHandle(); - // NOLINTNEXTLINE(misc-misplaced-const) - const HIMC himc = pImmGetContext( hwnd ); - bool enabled = pImmGetOpenStatus( himc ); - pImmReleaseContext( hwnd, himc ); - return enabled; - } - return false; - } - - void enable_ime() { - if( hImm ) { - // NOLINTNEXTLINE(misc-misplaced-const) - const HWND hwnd = getWindowHandle(); - // NOLINTNEXTLINE(misc-misplaced-const) - const HIMC himc = pImmGetContext( hwnd ); - pImmSetOpenStatus( himc, TRUE ); - pImmReleaseContext( hwnd, himc ); - } - } - - void disable_ime() { - if( hImm ) { - // NOLINTNEXTLINE(misc-misplaced-const) - const HWND hwnd = getWindowHandle(); - // NOLINTNEXTLINE(misc-misplaced-const) - const HIMC himc = pImmGetContext( hwnd ); - pImmSetOpenStatus( himc, FALSE ); - pImmReleaseContext( hwnd, himc ); - } - } -}; - -static imm_wrapper imm; -#endif - -static bool ime_enabled() -{ -#if defined( __ANDROID__ ) - return false; // always call disable_ime() (i.e. do nothing) on return -#elif defined( _WIN32 ) - return imm.ime_enabled(); -#endif - return false; - // TODO: other platforms? -} - -void enable_ime() -{ -#if defined( __ANDROID__ ) - if( get_option( "ANDROID_AUTO_KEYBOARD" ) ) { - SDL_StartTextInput(); - } -#elif defined( _WIN32 ) - imm.enable_ime(); -#endif - // TODO: other platforms? -} - -void disable_ime() -{ -#if defined( __ANDROID__ ) - // the original android code did nothing, so don't change it -#elif defined( _WIN32 ) - imm.disable_ime(); -#endif - // TODO: other platforms? -} - -ime_sentry::ime_sentry( ime_sentry::mode m ) : previously_enabled( ime_enabled() ) -{ - switch( m ) { - case enable: - enable_ime(); - break; - case disable: - disable_ime(); - break; - case keep: - // do nothing - break; - } -} - -ime_sentry::~ime_sentry() -{ - if( previously_enabled ) { - enable_ime(); - } else { - disable_ime(); - } -} diff --git a/src/ime.h b/src/ime.h deleted file mode 100644 index c6daf0032aac5..0000000000000 --- a/src/ime.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once -#ifndef CATA_SRC_IME_H -#define CATA_SRC_IME_H - -/** - * Enable or disable IME for text/keyboard input - */ -void enable_ime(); -void disable_ime(); - -/** - * used before text input to change IME mode and auto-restore IME mode when leaving the scope - */ -class ime_sentry -{ - public: - enum mode { - enable = 0, - disable = 1, - keep = 2, - }; - - ime_sentry( mode m = enable ); - ~ime_sentry(); - private: - bool previously_enabled; -}; - -#endif // CATA_SRC_IME_H diff --git a/src/input.cpp b/src/input.cpp index e970cde50727a..83cfd0a56c336 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -20,7 +20,6 @@ #include "filesystem.h" #include "game.h" #include "help.h" -#include "ime.h" #include "json.h" #include "map.h" #include "optional.h" @@ -81,6 +80,15 @@ bool is_mouse_enabled() #endif } +static bool is_keycode_mode_supported() +{ +#if defined(TILES) and !defined(__ANDROID__) + return true; +#else + return false; +#endif +} + //helper function for those have problem inputting certain characters. std::string get_input_string_from_file( const std::string &fname ) { @@ -98,6 +106,15 @@ std::string get_input_string_from_file( const std::string &fname ) return ret; } +input_event::input_event( const std::set &mod, const int s, const input_event_t t ) + : type( t ), modifiers( mod ), edit_refresh( false ) +{ + sequence.emplace_back( s ); +#if defined(__ANDROID__) + shortcut_last_used_action_counter = 0; +#endif +} + int input_event::get_first_input() const { if( sequence.empty() ) { @@ -159,7 +176,7 @@ void input_manager::init() action_contexts[action_id].clear(); touched.insert( a.second ); } - add_input_for_action( action_id, context, input_event( a.first, input_event_t::keyboard ) ); + add_input_for_action( action_id, context, input_event( a.first, input_event_t::keyboard_char ) ); } // Unmap actions that are explicitly not mapped for( const auto &elem : unbound_keymap ) { @@ -181,6 +198,8 @@ void input_manager::init() } } +static constexpr int current_keybinding_version = 1; + void input_manager::load( const std::string &file_name, bool is_user_preferences ) { std::ifstream data_file( file_name.c_str(), std::ifstream::in | std::ifstream::binary ); @@ -202,6 +221,13 @@ void input_manager::load( const std::string &file_name, bool is_user_preferences // JSON object representing the action JsonObject action = jsin.get_object(); + int version = current_keybinding_version; + if( is_user_preferences ) { + // if there isn't a "version" value it means the object was written before + // introduction of keybinding version, which is denoted by version 0. + version = action.get_int( "version", 0 ); + } + const std::string type = action.get_string( "type", "keybinding" ); if( type != "keybinding" ) { debugmsg( "Only objects of type 'keybinding' (not %s) should appear in the " @@ -223,26 +249,57 @@ void input_manager::load( const std::string &file_name, bool is_user_preferences t_input_event_list events; for( const JsonObject keybinding : action.get_array( "bindings" ) ) { std::string input_method = keybinding.get_string( "input_method" ); - input_event new_event; - if( input_method == "keyboard" ) { - new_event.type = input_event_t::keyboard; + std::vector new_events( 1 ); + if( input_method == "keyboard_any" ) { + new_events.resize( 2 ); + new_events[0].type = input_event_t::keyboard_char; + new_events[1].type = input_event_t::keyboard_code; + } else if( input_method == "keyboard_char" || input_method == "keyboard" ) { + new_events[0].type = input_event_t::keyboard_char; + } else if( input_method == "keyboard_code" ) { + new_events[0].type = input_event_t::keyboard_code; } else if( input_method == "gamepad" ) { - new_event.type = input_event_t::gamepad; + new_events[0].type = input_event_t::gamepad; } else if( input_method == "mouse" ) { - new_event.type = input_event_t::mouse; + new_events[0].type = input_event_t::mouse; + } else { + keybinding.throw_error( "unknown input_method", "input_method" ); + } + + if( keybinding.has_member( "mod" ) ) { + for( const JsonValue &val : keybinding.get_array( "mod" ) ) { + const std::string str = val; + keymod_t mod = keymod_t::ctrl; + if( str == "ctrl" ) { + mod = keymod_t::ctrl; + } else if( str == "alt" ) { + mod = keymod_t::alt; + } else if( str == "shift" ) { + mod = keymod_t::shift; + } else { + val.throw_error( "unknown modifier name" ); + } + for( input_event &new_event : new_events ) { + new_event.modifiers.emplace( mod ); + } + } } if( keybinding.has_array( "key" ) ) { for( const std::string line : keybinding.get_array( "key" ) ) { - new_event.sequence.push_back( get_keycode( line ) ); + for( input_event &new_event : new_events ) { + new_event.sequence.push_back( get_keycode( new_event.type, line ) ); + } } } else { // assume string if not array, and throw if not string - new_event.sequence.push_back( - get_keycode( keybinding.get_string( "key" ) ) - ); + for( input_event &new_event : new_events ) { + new_event.sequence.push_back( + get_keycode( new_event.type, keybinding.get_string( "key" ) ) + ); + } } - events.push_back( new_event ); + events.insert( events.end(), new_events.begin(), new_events.end() ); } // An invariant of this class is that user-created, local keybindings @@ -262,6 +319,17 @@ void input_manager::load( const std::string &file_name, bool is_user_preferences // In case this is the second file containing user preferences, // this replaces the default bindings with the user's preferences. action_attributes &attributes = actions[action_id]; + if( is_user_preferences && version == 0 ) { + // version 0 means the keybinding was written prior to the division + // of `input_event_t::keyboard_char` and `input_event_t::keyboard_code`, + // so we copy any `input_event_t::keyboard_code` event from the default + // keybindings to be compatible with old user keybinding files. + for( const input_event &evt : attributes.input_events ) { + if( evt.type == input_event_t::keyboard_code ) { + events.emplace_back( evt ); + } + } + } attributes.input_events = events; if( action.has_member( "is_user_created" ) ) { attributes.is_user_created = action.get_bool( "is_user_created" ); @@ -283,6 +351,7 @@ void input_manager::save() jsout.start_object(); jsout.member( "id", action.first ); + jsout.member( "version", current_keybinding_version ); jsout.member( "category", a.first ); bool is_user_created = action.second.is_user_created; if( is_user_created ) { @@ -294,8 +363,11 @@ void input_manager::save() for( const auto &event : events ) { jsout.start_object(); switch( event.type ) { - case input_event_t::keyboard: - jsout.member( "input_method", "keyboard" ); + case input_event_t::keyboard_char: + jsout.member( "input_method", "keyboard_char" ); + break; + case input_event_t::keyboard_code: + jsout.member( "input_method", "keyboard_code" ); break; case input_event_t::gamepad: jsout.member( "input_method", "gamepad" ); @@ -306,6 +378,26 @@ void input_manager::save() default: throw std::runtime_error( "unknown input_event_t" ); } + + jsout.member( "mod" ); + jsout.start_array(); + for( const keymod_t mod : event.modifiers ) { + switch( mod ) { + case keymod_t::ctrl: + jsout.write( "ctrl" ); + break; + case keymod_t::alt: + jsout.write( "alt" ); + break; + case keymod_t::shift: + jsout.write( "shift" ); + break; + default: + throw std::runtime_error( "unknown keymod_t" ); + } + } + jsout.end_array(); + jsout.member( "key" ); jsout.start_array(); for( size_t i = 0; i < event.sequence.size(); i++ ) { @@ -323,16 +415,28 @@ void input_manager::save() }, _( "key bindings configuration" ) ); } -void input_manager::add_keycode_pair( int ch, const std::string &name ) +void input_manager::add_keyboard_char_keycode_pair( int ch, const std::string &name ) { - keycode_to_keyname[ch] = name; - keyname_to_keycode[name] = ch; + keyboard_char_keycode_to_keyname[ch] = name; + keyboard_char_keyname_to_keycode[name] = ch; +} + +void input_manager::add_keyboard_code_keycode_pair( const int ch, const std::string &name ) +{ + keyboard_code_keycode_to_keyname[ch] = name; + keyboard_code_keyname_to_keycode[name] = ch; } void input_manager::add_gamepad_keycode_pair( int ch, const std::string &name ) { gamepad_keycode_to_keyname[ch] = name; - keyname_to_keycode[name] = ch; + gamepad_keyname_to_keycode[name] = ch; +} + +void input_manager::add_mouse_keycode_pair( const int ch, const std::string &name ) +{ + mouse_keycode_to_keyname[ch] = name; + mouse_keyname_to_keycode[name] = ch; } constexpr int char_key_beg = ' '; @@ -344,30 +448,91 @@ void input_manager::init_keycode_mapping() // to themselves(see ASCII table) for( char c = char_key_beg; c <= char_key_end; c++ ) { std::string name( 1, c ); - add_keycode_pair( c, name ); - } - - add_keycode_pair( '\t', translate_marker_context( "key name", "TAB" ) ); - add_keycode_pair( KEY_BTAB, translate_marker_context( "key name", "BACKTAB" ) ); - add_keycode_pair( ' ', translate_marker_context( "key name", "SPACE" ) ); - add_keycode_pair( KEY_UP, translate_marker_context( "key name", "UP" ) ); - add_keycode_pair( KEY_DOWN, translate_marker_context( "key name", "DOWN" ) ); - add_keycode_pair( KEY_LEFT, translate_marker_context( "key name", "LEFT" ) ); - add_keycode_pair( KEY_RIGHT, translate_marker_context( "key name", "RIGHT" ) ); - add_keycode_pair( KEY_NPAGE, translate_marker_context( "key name", "NPAGE" ) ); - add_keycode_pair( KEY_PPAGE, translate_marker_context( "key name", "PPAGE" ) ); - add_keycode_pair( KEY_ESCAPE, translate_marker_context( "key name", "ESC" ) ); - add_keycode_pair( KEY_BACKSPACE, translate_marker_context( "key name", "BACKSPACE" ) ); - add_keycode_pair( KEY_HOME, translate_marker_context( "key name", "HOME" ) ); - add_keycode_pair( KEY_BREAK, translate_marker_context( "key name", "BREAK" ) ); - add_keycode_pair( KEY_END, translate_marker_context( "key name", "END" ) ); - add_keycode_pair( '\n', translate_marker_context( "key name", "RETURN" ) ); + add_keyboard_char_keycode_pair( c, name ); + add_keyboard_code_keycode_pair( c, name ); + } + + add_keyboard_char_keycode_pair( '\t', translate_marker_context( "key name", "TAB" ) ); + add_keyboard_char_keycode_pair( KEY_BTAB, translate_marker_context( "key name", "BACKTAB" ) ); + add_keyboard_char_keycode_pair( ' ', translate_marker_context( "key name", "SPACE" ) ); + add_keyboard_char_keycode_pair( KEY_UP, translate_marker_context( "key name", "UP" ) ); + add_keyboard_char_keycode_pair( KEY_DOWN, translate_marker_context( "key name", "DOWN" ) ); + add_keyboard_char_keycode_pair( KEY_LEFT, translate_marker_context( "key name", "LEFT" ) ); + add_keyboard_char_keycode_pair( KEY_RIGHT, translate_marker_context( "key name", "RIGHT" ) ); + add_keyboard_char_keycode_pair( KEY_NPAGE, translate_marker_context( "key name", "NPAGE" ) ); + add_keyboard_char_keycode_pair( KEY_PPAGE, translate_marker_context( "key name", "PPAGE" ) ); + add_keyboard_char_keycode_pair( KEY_ESCAPE, translate_marker_context( "key name", "ESC" ) ); + add_keyboard_char_keycode_pair( KEY_BACKSPACE, + translate_marker_context( "key name", "BACKSPACE" ) ); + add_keyboard_char_keycode_pair( KEY_HOME, translate_marker_context( "key name", "HOME" ) ); + add_keyboard_char_keycode_pair( KEY_BREAK, translate_marker_context( "key name", "BREAK" ) ); + add_keyboard_char_keycode_pair( KEY_END, translate_marker_context( "key name", "END" ) ); + add_keyboard_char_keycode_pair( '\n', translate_marker_context( "key name", "RETURN" ) ); // function keys, as defined by ncurses for( int i = F_KEY_NUM_BEG; i <= F_KEY_NUM_END; i++ ) { // not marked for translation here, but specially handled in get_keyname so // it gets properly translated. - add_keycode_pair( KEY_F( i ), string_format( "F%d", i ) ); + add_keyboard_char_keycode_pair( KEY_F( i ), string_format( "F%d", i ) ); + } + + static const std::vector> keyboard_code_keycode_pair = { + { keycode::backspace, translate_marker_context( "key name", "BACKSPACE" ) }, + { keycode::tab, translate_marker_context( "key name", "TAB" ) }, + { keycode::return_, translate_marker_context( "key name", "RETURN" ) }, + { keycode::escape, translate_marker_context( "key name", "ESC" ) }, + { keycode::space, translate_marker_context( "key name", "SPACE" ) }, + { keycode::f1, translate_marker_context( "key name", "F1" ) }, + { keycode::f2, translate_marker_context( "key name", "F2" ) }, + { keycode::f3, translate_marker_context( "key name", "F3" ) }, + { keycode::f4, translate_marker_context( "key name", "F4" ) }, + { keycode::f5, translate_marker_context( "key name", "F5" ) }, + { keycode::f6, translate_marker_context( "key name", "F6" ) }, + { keycode::f7, translate_marker_context( "key name", "F7" ) }, + { keycode::f8, translate_marker_context( "key name", "F8" ) }, + { keycode::f9, translate_marker_context( "key name", "F9" ) }, + { keycode::f10, translate_marker_context( "key name", "F10" ) }, + { keycode::f11, translate_marker_context( "key name", "F11" ) }, + { keycode::f12, translate_marker_context( "key name", "F12" ) }, + { keycode::ppage, translate_marker_context( "key name", "PPAGE" ) }, + { keycode::home, translate_marker_context( "key name", "HOME" ) }, + { keycode::end, translate_marker_context( "key name", "END" ) }, + { keycode::npage, translate_marker_context( "key name", "NPAGE" ) }, + { keycode::right, translate_marker_context( "key name", "RIGHT" ) }, + { keycode::left, translate_marker_context( "key name", "LEFT" ) }, + { keycode::down, translate_marker_context( "key name", "DOWN" ) }, + { keycode::up, translate_marker_context( "key name", "UP" ) }, + { keycode::kp_divide, translate_marker_context( "key name", "KEYPAD_DIVIDE" ) }, + { keycode::kp_multiply, translate_marker_context( "key name", "KEYPAD_MULTIPLY" ) }, + { keycode::kp_minus, translate_marker_context( "key name", "KEYPAD_MINUS" ) }, + { keycode::kp_plus, translate_marker_context( "key name", "KEYPAD_PLUS" ) }, + { keycode::kp_enter, translate_marker_context( "key name", "KEYPAD_ENTER" ) }, + { keycode::kp_1, translate_marker_context( "key name", "KEYPAD_1" ) }, + { keycode::kp_2, translate_marker_context( "key name", "KEYPAD_2" ) }, + { keycode::kp_3, translate_marker_context( "key name", "KEYPAD_3" ) }, + { keycode::kp_4, translate_marker_context( "key name", "KEYPAD_4" ) }, + { keycode::kp_5, translate_marker_context( "key name", "KEYPAD_5" ) }, + { keycode::kp_6, translate_marker_context( "key name", "KEYPAD_6" ) }, + { keycode::kp_7, translate_marker_context( "key name", "KEYPAD_7" ) }, + { keycode::kp_8, translate_marker_context( "key name", "KEYPAD_8" ) }, + { keycode::kp_9, translate_marker_context( "key name", "KEYPAD_9" ) }, + { keycode::kp_0, translate_marker_context( "key name", "KEYPAD_0" ) }, + { keycode::kp_period, translate_marker_context( "key name", "KEYPAD_PERIOD" ) }, + { keycode::f13, translate_marker_context( "key name", "F13" ) }, + { keycode::f14, translate_marker_context( "key name", "F14" ) }, + { keycode::f15, translate_marker_context( "key name", "F15" ) }, + { keycode::f16, translate_marker_context( "key name", "F16" ) }, + { keycode::f17, translate_marker_context( "key name", "F17" ) }, + { keycode::f18, translate_marker_context( "key name", "F18" ) }, + { keycode::f19, translate_marker_context( "key name", "F19" ) }, + { keycode::f20, translate_marker_context( "key name", "F20" ) }, + { keycode::f21, translate_marker_context( "key name", "F21" ) }, + { keycode::f22, translate_marker_context( "key name", "F22" ) }, + { keycode::f23, translate_marker_context( "key name", "F23" ) }, + { keycode::f24, translate_marker_context( "key name", "F24" ) }, + }; + for( const auto &v : keyboard_code_keycode_pair ) { + add_keyboard_code_keycode_pair( v.first, v.second ); } add_gamepad_keycode_pair( JOY_LEFT, translate_marker_context( "key name", "JOY_LEFT" ) ); @@ -388,18 +553,37 @@ void input_manager::init_keycode_mapping() add_gamepad_keycode_pair( JOY_6, translate_marker_context( "key name", "JOY_6" ) ); add_gamepad_keycode_pair( JOY_7, translate_marker_context( "key name", "JOY_7" ) ); - keyname_to_keycode["MOUSE_LEFT"] = MOUSE_BUTTON_LEFT; - keyname_to_keycode["MOUSE_RIGHT"] = MOUSE_BUTTON_RIGHT; - keyname_to_keycode["SCROLL_UP"] = SCROLLWHEEL_UP; - keyname_to_keycode["SCROLL_DOWN"] = SCROLLWHEEL_DOWN; - keyname_to_keycode["MOUSE_MOVE"] = MOUSE_MOVE; + add_mouse_keycode_pair( MOUSE_BUTTON_LEFT, translate_marker_context( "key name", "MOUSE_LEFT" ) ); + add_mouse_keycode_pair( MOUSE_BUTTON_RIGHT, translate_marker_context( "key name", "MOUSE_RIGHT" ) ); + add_mouse_keycode_pair( SCROLLWHEEL_UP, translate_marker_context( "key name", "SCROLL_UP" ) ); + add_mouse_keycode_pair( SCROLLWHEEL_DOWN, translate_marker_context( "key name", "SCROLL_DOWN" ) ); + add_mouse_keycode_pair( MOUSE_MOVE, translate_marker_context( "key name", "MOUSE_MOVE" ) ); } -int input_manager::get_keycode( const std::string &name ) const +int input_manager::get_keycode( const input_event_t inp_type, const std::string &name ) const { - const t_name_to_key_map::const_iterator a = keyname_to_keycode.find( name ); - if( a != keyname_to_keycode.end() ) { - return a->second; + const t_name_to_key_map *map = nullptr; + switch( inp_type ) { + default: + break; + case input_event_t::keyboard_char: + map = &keyboard_char_keyname_to_keycode; + break; + case input_event_t::keyboard_code: + map = &keyboard_code_keyname_to_keycode; + break; + case input_event_t::gamepad: + map = &gamepad_keyname_to_keycode; + break; + case input_event_t::mouse: + map = &mouse_keyname_to_keycode; + break; + } + if( map ) { + const auto it = map->find( name ); + if( it != map->end() ) { + return it->second; + } } // Not found in map, try to parse as int if( name.compare( 0, 8, "UNKNOWN_" ) == 0 ) { @@ -410,51 +594,58 @@ int input_manager::get_keycode( const std::string &name ) const std::string input_manager::get_keyname( int ch, input_event_t inp_type, bool portable ) const { - cata::optional raw; - if( inp_type == input_event_t::keyboard ) { - const t_key_to_name_map::const_iterator a = keycode_to_keyname.find( ch ); - if( a != keycode_to_keyname.end() ) { - if( IS_F_KEY( ch ) ) { - // special case it since F key names are generated using loop - // and not marked individually for translation - if( portable ) { - return a->second; - } else { - return string_format( pgettext( "function key name", "F%d" ), F_KEY_NUM( ch ) ); - } - } else if( ch >= char_key_beg && ch <= char_key_end && ch != ' ' ) { - // character keys except space need no translation - return a->second; + const t_key_to_name_map *map = nullptr; + switch( inp_type ) { + default: + break; + case input_event_t::keyboard_char: + map = &keyboard_char_keycode_to_keyname; + break; + case input_event_t::keyboard_code: + map = &keyboard_code_keycode_to_keyname; + break; + case input_event_t::gamepad: + map = &gamepad_keycode_to_keyname; + break; + case input_event_t::mouse: + map = &mouse_keycode_to_keyname; + break; + } + if( map ) { + const auto it = map->find( ch ); + if( it != map->end() ) { + switch( inp_type ) { + case input_event_t::keyboard_char: + if( IS_F_KEY( ch ) ) { + // special case it since F key names are generated using loop + // and not marked individually for translation + if( portable ) { + return it->second; + } else { + return string_format( pgettext( "function key name", "F%d" ), F_KEY_NUM( ch ) ); + } + } else if( ch >= char_key_beg && ch <= char_key_end && ch != ' ' ) { + // character keys except space need no translation + return it->second; + } + break; + case input_event_t::keyboard_code: + if( ch >= char_key_beg && ch < char_key_end && ch != ' ' ) { + // character keys except space need no translation + return it->second; + } + break; + default: + break; } - raw = a->second; - } - } else if( inp_type == input_event_t::mouse ) { - if( ch == MOUSE_BUTTON_LEFT ) { - raw = translate_marker_context( "key name", "MOUSE_LEFT" ); - } else if( ch == MOUSE_BUTTON_RIGHT ) { - raw = translate_marker_context( "key name", "MOUSE_RIGHT" ); - } else if( ch == SCROLLWHEEL_UP ) { - raw = translate_marker_context( "key name", "SCROLL_UP" ); - } else if( ch == SCROLLWHEEL_DOWN ) { - raw = translate_marker_context( "key name", "SCROLL_DOWN" ); - } else if( ch == MOUSE_MOVE ) { - raw = translate_marker_context( "key name", "MOUSE_MOVE" ); + return portable ? it->second : pgettext( "key name", it->second.c_str() ); } - } else if( inp_type == input_event_t::gamepad ) { - const t_key_to_name_map::const_iterator a = gamepad_keycode_to_keyname.find( ch ); - if( a != gamepad_keycode_to_keyname.end() ) { - raw = a->second; - } - } else { - raw = translate_marker_context( "key name", "UNKNOWN" ); } - if( !raw ) { - if( portable ) { - return std::string( "UNKNOWN_" ) + int_to_str( ch ); - } + if( portable ) { + return std::string( "UNKNOWN_" ) + int_to_str( ch ); + } else { return string_format( _( "unknown key %ld" ), ch ); } - return portable ? *raw : pgettext( "key name", raw->c_str() ); } const std::vector &input_manager::get_input_for_action( const std::string @@ -695,7 +886,7 @@ std::vector input_context::keys_bound_to( const std::string &action_descri for( const auto &events_event : events ) { // Ignore multi-key input and non-keyboard input // TODO: fix for Unicode. - if( events_event.type == input_event_t::keyboard && events_event.sequence.size() == 1 ) { + if( events_event.type == input_event_t::keyboard_char && events_event.sequence.size() == 1 ) { if( !restrict_to_printable || ( events_event.sequence.front() < 0xFF && isprint( events_event.sequence.front() ) ) ) { result.push_back( static_cast( events_event.sequence.front() ) ); @@ -720,7 +911,7 @@ std::string input_context::get_available_single_char_hotkeys( std::string reques category ); for( const auto &events_event : events ) { // Only consider keyboard events without modifiers - if( events_event.type == input_event_t::keyboard && events_event.modifiers.empty() ) { + if( events_event.type == input_event_t::keyboard_char && events_event.modifiers.empty() ) { requested_keys.erase( std::remove_if( requested_keys.begin(), requested_keys.end(), ContainsPredicate, char>( events_event.sequence ) ), @@ -734,7 +925,7 @@ std::string input_context::get_available_single_char_hotkeys( std::string reques const input_context::input_event_filter input_context::disallow_lower_case = []( const input_event &evt ) -> bool { - return evt.type != input_event_t::keyboard || + return evt.type != input_event_t::keyboard_char || // std::lower from is undefined outside unsigned char range // and std::lower from may throw bad_cast for some locales evt.get_first_input() < 'a' || evt.get_first_input() > 'z'; @@ -745,6 +936,12 @@ const input_context::input_event_filter input_context::allow_all_keys = return true; }; +static const std::vector> keymod_desc = { + { keymod_t::ctrl, to_translation( "key modifier", "CTRL-" ) }, + { keymod_t::alt, to_translation( "key modifier", "ALT-" ) }, + { keymod_t::shift, to_translation( "key modifier", "SHIFT-" ) }, +}; + std::string input_context::get_desc( const std::string &action_descriptor, const unsigned int max_limit, const input_context::input_event_filter &evt_filter ) const @@ -765,10 +962,7 @@ std::string input_context::get_desc( const std::string &action_descriptor, for( auto &events_i : events ) { const input_event &event = events_i; - if( evt_filter( event ) && - // Only display gamepad buttons if a gamepad is available. - ( gamepad_available() || event.type != input_event_t::gamepad ) ) { - + if( is_event_type_enabled( event.type ) && evt_filter( event ) ) { inputs_to_show.push_back( event ); } @@ -783,6 +977,12 @@ std::string input_context::get_desc( const std::string &action_descriptor, std::string rval; for( size_t i = 0; i < inputs_to_show.size(); ++i ) { + // test in fixed order to generate consistent description + for( const auto &v : keymod_desc ) { + if( inputs_to_show[i].modifiers.count( v.first ) ) { + rval += v.second.translated(); + } + } for( size_t j = 0; j < inputs_to_show[i].sequence.size(); ++j ) { rval += inp_mngr.get_keyname( inputs_to_show[i].sequence[j], inputs_to_show[i].type ); } @@ -811,17 +1011,17 @@ std::string input_context::get_desc( const std::string &action_descriptor, bool na = true; for( const auto &evt : events ) { - if( evt_filter( evt ) && - // Only display gamepad buttons if a gamepad is available. - ( gamepad_available() || evt.type != input_event_t::gamepad ) ) { - + if( is_event_type_enabled( evt.type ) && evt_filter( evt ) ) { na = false; - if( evt.type == input_event_t::keyboard && evt.sequence.size() == 1 ) { + if( ( evt.type == input_event_t::keyboard_char || evt.type == input_event_t::keyboard_code ) && + evt.modifiers.empty() && evt.sequence.size() == 1 ) { const int ch = evt.get_first_input(); - const std::string key = utf32_to_utf8( ch ); - const auto pos = ci_find_substr( text, key ); - if( ch > ' ' && ch <= '~' && pos >= 0 ) { - return text.substr( 0, pos ) + "(" + key + ")" + text.substr( pos + key.size() ); + if( ch > ' ' && ch <= '~' ) { + const std::string key = utf32_to_utf8( ch ); + const auto pos = ci_find_substr( text, key ); + if( pos >= 0 ) { + return text.substr( 0, pos ) + "(" + key + ")" + text.substr( pos + key.size() ); + } } } } @@ -857,7 +1057,7 @@ const std::string &input_context::handle_input( const int timeout ) next_action.type = input_event_t::error; const std::string *result = &CATA_ERROR; while( true ) { - next_action = inp_mngr.get_input_event(); + next_action = inp_mngr.get_input_event( preferred_keyboard_mode ); if( next_action.type == input_event_t::timeout ) { result = &TIMEOUT; break; @@ -993,7 +1193,7 @@ action_id input_context::display_menu( const bool permit_execute_action ) action_id action_to_execute = ACTION_NULL; // Shamelessly stolen from help.cpp - input_context ctxt( "HELP_KEYBINDINGS" ); + input_context ctxt( "HELP_KEYBINDINGS", keyboard_mode::keychar ); ctxt.register_action( "UP", to_translation( "Scroll up" ) ); ctxt.register_action( "DOWN", to_translation( "Scroll down" ) ); ctxt.register_action( "PAGE_DOWN" ); @@ -1127,8 +1327,6 @@ action_id input_context::display_menu( const bool permit_execute_action ) }; ui.on_redraw( redraw ); - // do not switch IME mode now, but restore previous mode on return - ime_sentry sentry( ime_sentry::keep ); while( true ) { ui_manager::redraw(); @@ -1198,6 +1396,7 @@ action_id input_context::display_menu( const bool permit_execute_action ) popup( _( "There are already local keybindings defined for this action, please remove them first." ) ); } else if( status == s_add || status == s_add_global ) { const input_event new_event = query_popup() + .preferred_keyboard_mode( preferred_keyboard_mode ) .message( _( "New key for %s" ), name ) .allow_anykey( true ) .query() @@ -1301,16 +1500,18 @@ int input_manager::get_previously_pressed_key() const void input_manager::wait_for_any_key() { #if defined(__ANDROID__) - input_context ctxt( "WAIT_FOR_ANY_KEY" ); + input_context ctxt( "WAIT_FOR_ANY_KEY", keyboard_mode::keycode ); #endif while( true ) { - const input_event evt = inp_mngr.get_input_event(); + const input_event evt = inp_mngr.get_input_event( keyboard_mode::keycode ); switch( evt.type ) { - case input_event_t::keyboard: + case input_event_t::keyboard_char: if( !evt.sequence.empty() ) { return; } break; + case input_event_t::keyboard_code: + return; // errors are accepted as well to avoid an infinite loop case input_event_t::error: return; @@ -1433,13 +1634,21 @@ std::string input_context::press_x( const std::string &action_id, const std::str if( action_id == "COORDINATE" ) { return _( "mouse movement" ); } - const input_manager::t_input_event_list &events = inp_mngr.get_input_for_action( action_id, - category ); + input_manager::t_input_event_list events = inp_mngr.get_input_for_action( action_id, category ); + events.erase( std::remove_if( events.begin(), events.end(), [this]( const input_event & evt ) { + return !is_event_type_enabled( evt.type ); + } ), events.end() ); if( events.empty() ) { return key_unbound; } std::string keyed = key_bound_pre; for( size_t j = 0; j < events.size(); j++ ) { + // test in fixed order to generate consistent description + for( const auto &v : keymod_desc ) { + if( events[j].modifiers.count( v.first ) ) { + keyed += v.second.translated(); + } + } for( size_t k = 0; k < events[j].sequence.size(); ++k ) { keyed += inp_mngr.get_keyname( events[j].sequence[k], events[j].type ); } @@ -1489,3 +1698,22 @@ void input_context::reset_timeout() { timeout = -1; } + +bool input_context::is_event_type_enabled( const input_event_t type ) const +{ + switch( type ) { + case input_event_t::error: + return false; + case input_event_t::timeout: + return true; + case input_event_t::keyboard_char: + return preferred_keyboard_mode == keyboard_mode::keychar || !is_keycode_mode_supported(); + case input_event_t::keyboard_code: + return preferred_keyboard_mode == keyboard_mode::keycode && is_keycode_mode_supported(); + case input_event_t::gamepad: + return gamepad_available(); + case input_event_t::mouse: + return true; + } + return true; +} diff --git a/src/input.h b/src/input.h index 5d7a7be5de52a..8a468042a5eba 100644 --- a/src/input.h +++ b/src/input.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -29,6 +30,7 @@ namespace catacurses class window; } // namespace catacurses +// Curses key constants static constexpr int KEY_ESCAPE = 27; static constexpr int KEY_MIN = 0x101; /* minimum extended key value */ //<---------not used @@ -68,6 +70,72 @@ static constexpr int KEY_ENTER = 0x157; /* enter */ static constexpr int KEY_BTAB = 0x161; /* back-tab = shift + tab */ static constexpr int KEY_END = 0x168; /* End */ +// Platform independent key code (though largely based on SDL key code) +// +// These and other code related to keyboard_code event should NOT be guarded with +// platform macros, since they are required to load and save keyboard_code events, +// which should always be done regardless whether the platform supports it, otherwise +// custom keybindings might be lost when someone switches e.g. from tiles to curses +// and save the keybindings, and switches back to tiles later. +namespace keycode +{ +enum : int { + backspace = 0x08, + tab = 0x09, + return_ = 0x0D, + escape = 0x1B, + space = 0x20, + f1 = 0x4000003A, + f2 = 0x4000003B, + f3 = 0x4000003C, + f4 = 0x4000003D, + f5 = 0x4000003E, + f6 = 0x4000003F, + f7 = 0x40000040, + f8 = 0x40000041, + f9 = 0x40000042, + f10 = 0x40000043, + f11 = 0x40000044, + f12 = 0x40000045, + home = 0x4000004A, + ppage = 0x4000004B, + end = 0x4000004D, + npage = 0x4000004E, + right = 0x4000004F, + left = 0x40000050, + down = 0x40000051, + up = 0x40000052, + kp_divide = 0x40000054, + kp_multiply = 0x40000055, + kp_minus = 0x40000056, + kp_plus = 0x40000057, + kp_enter = 0x40000058, + kp_1 = 0x40000059, + kp_2 = 0x4000005A, + kp_3 = 0x4000005B, + kp_4 = 0x4000005C, + kp_5 = 0x4000005D, + kp_6 = 0x4000005E, + kp_7 = 0x4000005F, + kp_8 = 0x40000060, + kp_9 = 0x40000061, + kp_0 = 0x40000062, + kp_period = 0x40000063, + f13 = 0x40000068, + f14 = 0x40000069, + f15 = 0x4000006A, + f16 = 0x4000006B, + f17 = 0x4000006C, + f18 = 0x4000006D, + f19 = 0x4000006E, + f20 = 0x4000006F, + f21 = 0x40000070, + f22 = 0x40000071, + f23 = 0x40000072, + f24 = 0x40000073, +}; +} // namespace keycode + static constexpr int LEGEND_HEIGHT = 11; static constexpr int BORDER_SPACE = 2; @@ -79,11 +147,20 @@ enum mouse_buttons { MOUSE_BUTTON_LEFT = 1, MOUSE_BUTTON_RIGHT, SCROLLWHEEL_UP, enum class input_event_t : int { error, timeout, - keyboard, + // used on platforms with only character/text input, such as curses + keyboard_char, + // used on platforms with raw keycode input, such as non-android sdl + keyboard_code, gamepad, mouse }; +enum class keymod_t { + ctrl, + alt, + shift, +}; + /** * An instance of an input, like a keypress etc. * @@ -95,7 +172,7 @@ enum class input_event_t : int { struct input_event { input_event_t type; - std::vector modifiers; // Keys that need to be held down for + std::set modifiers; // Keys that need to be held down for // this event to be activated. std::vector sequence; // The sequence of key or mouse events that @@ -128,6 +205,7 @@ struct input_event { shortcut_last_used_action_counter = 0; #endif } + input_event( const std::set &mod, int s, input_event_t t ); int get_first_input() const; @@ -148,29 +226,7 @@ struct input_event { #endif bool operator==( const input_event &other ) const { - if( type != other.type ) { - return false; - } - - if( sequence.size() != other.sequence.size() ) { - return false; - } - for( size_t i = 0; i < sequence.size(); ++i ) { - if( sequence[i] != other.sequence[i] ) { - return false; - } - } - - if( modifiers.size() != other.modifiers.size() ) { - return false; - } - for( size_t i = 0; i < modifiers.size(); ++i ) { - if( modifiers[i] != other.modifiers[i] ) { - return false; - } - } - - return true; + return type == other.type && modifiers == other.modifiers && sequence == other.sequence; } }; @@ -207,6 +263,18 @@ struct action_attributes { #define JOY_LEFTUP (256 + 7) #define JOY_LEFTDOWN (256 + 8) +enum class keyboard_mode { + // Accept character input and text input. Input in this mode + // may be manipulated by the system via IMEs or dead keys. + keychar, + // Accept raw key code input. Text input is not available in this + // mode. All keyboard events are directly fed to the program + // in this mode, bypassing IMEs and dead keys. Only supported on + // some platforms, such as non-android SDL. On other platforms + // this falls back to `keychar` automatically. + keycode, +}; + /** * Manages the translation from action IDs to associated input. * @@ -256,7 +324,7 @@ class input_manager /** * Get the keycode associated with the given key name. */ - int get_keycode( const std::string &name ) const; + int get_keycode( input_event_t inp_type, const std::string &name ) const; /** * Get the key name associated with the given keyboard keycode. @@ -274,7 +342,7 @@ class input_manager * * Defined in the respective platform wrapper, e.g. sdlcurse.cpp */ - input_event get_input_event(); + input_event get_input_event( keyboard_mode preferred_keyboard_mode = keyboard_mode::keychar ); /** * Wait until the user presses a key. Mouse and similar input is ignored, @@ -304,10 +372,15 @@ class input_manager t_action_contexts action_contexts; using t_key_to_name_map = std::map; - t_key_to_name_map keycode_to_keyname; + t_key_to_name_map keyboard_char_keycode_to_keyname; + t_key_to_name_map keyboard_code_keycode_to_keyname; t_key_to_name_map gamepad_keycode_to_keyname; + t_key_to_name_map mouse_keycode_to_keyname; using t_name_to_key_map = std::map; - t_name_to_key_map keyname_to_keycode; + t_name_to_key_map keyboard_char_keyname_to_keycode; + t_name_to_key_map keyboard_code_keyname_to_keycode; + t_name_to_key_map gamepad_keyname_to_keycode; + t_name_to_key_map mouse_keyname_to_keycode; // See @ref get_previously_pressed_key int previously_pressed_key; @@ -315,8 +388,10 @@ class input_manager // Maps the key names we see in keybindings.json and in-game to // the keycode integers. void init_keycode_mapping(); - void add_keycode_pair( int ch, const std::string &name ); + void add_keyboard_char_keycode_pair( int ch, const std::string &name ); + void add_keyboard_code_keycode_pair( int ch, const std::string &name ); void add_gamepad_keycode_pair( int ch, const std::string &name ); + void add_mouse_keycode_pair( int ch, const std::string &name ); /** * Load keybindings from a json file, override existing bindings. @@ -395,8 +470,11 @@ class input_context } // TODO: consider making the curses WINDOW an argument to the constructor, so that mouse input // outside that window can be ignored - input_context( const std::string &category ) : registered_any_input( false ), - category( category ), coordinate_input_received( false ), handling_coordinate_input( false ) { + input_context( const std::string &category, + const keyboard_mode preferred_keyboard_mode = keyboard_mode::keycode ) + : registered_any_input( false ), category( category ), + coordinate_input_received( false ), handling_coordinate_input( false ), + preferred_keyboard_mode( preferred_keyboard_mode ) { #if defined(__ANDROID__) input_context_stack.push_back( this ); allow_text_entry = false; @@ -697,6 +775,7 @@ class input_context input_event next_action; bool iso_mode = false; // should this context follow the game's isometric settings? int timeout = -1; + keyboard_mode preferred_keyboard_mode = keyboard_mode::keycode; /** * When registering for actions within an input_context, callers can @@ -706,6 +785,8 @@ class input_context */ std::map action_name_overrides; + bool is_event_type_enabled( input_event_t type ) const; + /** * Returns whether action uses the specified input */ diff --git a/src/inventory_ui.cpp b/src/inventory_ui.cpp index 5af36e06a7b94..bcc15e72458bf 100644 --- a/src/inventory_ui.cpp +++ b/src/inventory_ui.cpp @@ -5,7 +5,6 @@ #include "character.h" #include "colony.h" #include "debug.h" -#include "ime.h" #include "inventory.h" #include "item.h" #include "item_category.h" @@ -1705,8 +1704,6 @@ void inventory_selector::set_filter() current_ui->mark_resize(); } - ime_sentry sentry; - do { ui_manager::redraw(); spopup->query_string( /*loop=*/false ); @@ -1839,7 +1836,7 @@ void inventory_selector::draw_footer( const catacurses::window &w ) const inventory_selector::inventory_selector( Character &u, const inventory_selector_preset &preset ) : u( u ) , preset( preset ) - , ctxt( "INVENTORY" ) + , ctxt( "INVENTORY", keyboard_mode::keychar ) , active_column_index( 0 ) , mode( navigation_mode::ITEM ) , own_inv_column( preset ) diff --git a/src/item_action.cpp b/src/item_action.cpp index 8b13683de6d57..1c9759f6fca76 100644 --- a/src/item_action.cpp +++ b/src/item_action.cpp @@ -264,7 +264,7 @@ void game::item_action_menu() uilist kmenu; kmenu.text = _( "Execute which action?" ); kmenu.input_category = "ITEM_ACTIONS"; - input_context ctxt( "ITEM_ACTIONS" ); + input_context ctxt( "ITEM_ACTIONS", keyboard_mode::keychar ); for( const std::pair &id : item_actions ) { ctxt.register_action( id.first, id.second.name ); kmenu.additional_actions.emplace_back( id.first, id.second.name ); diff --git a/src/main_menu.cpp b/src/main_menu.cpp index 65012aff3301b..08d744e22af3b 100644 --- a/src/main_menu.cpp +++ b/src/main_menu.cpp @@ -24,7 +24,6 @@ #include "gamemode.h" #include "get_version.h" #include "help.h" -#include "ime.h" #include "loading_ui.h" #include "mapbuffer.h" #include "mapsharing.h" @@ -572,15 +571,6 @@ bool main_menu::opening_screen() std::string sInput = ctxt.get_raw_input().text; - // switch off ime at program start - if( ctxt.get_raw_input().sequence.empty() ) { - // FIXME: disable_ime only seems to work after receiving an input event - // with empty input sequence. (empty input event is also fired when the - // window loses focus, might be related?) - disable_ime(); - continue; - } - // check automatic menu shortcuts for( size_t i = 0; i < vMenuHotkeys.size(); ++i ) { for( const std::string &hotkey : vMenuHotkeys[i] ) { diff --git a/src/main_menu.h b/src/main_menu.h index 69976faf4491a..1d94fa9785d36 100644 --- a/src/main_menu.h +++ b/src/main_menu.h @@ -15,7 +15,7 @@ class main_menu { public: - main_menu() : ctxt( "MAIN_MENU" ) { } + main_menu() : ctxt( "MAIN_MENU", keyboard_mode::keychar ) { } // Shows the main menu and returns whether a game was started or not bool opening_screen(); diff --git a/src/messages.cpp b/src/messages.cpp index 0115960a91363..b4bd5270ad6d7 100644 --- a/src/messages.cpp +++ b/src/messages.cpp @@ -9,7 +9,6 @@ #include "debug.h" #include "enums.h" #include "game.h" -#include "ime.h" #include "input.h" #include "json.h" #include "optional.h" @@ -464,8 +463,6 @@ class dialog bool canceled = false; bool errored = false; - cata::optional filter_sentry; - bool first_init = true; }; } // namespace Messages @@ -693,9 +690,6 @@ void Messages::dialog::input() filter.query( false ); if( filter.confirmed() || filter.canceled() ) { filtering = false; - if( filter_sentry ) { - disable_ime(); - } } if( !filter.canceled() ) { const std::string &new_filter_str = filter.text(); @@ -729,13 +723,6 @@ void Messages::dialog::input() } } else if( action == "FILTER" ) { filtering = true; - if( filter_sentry ) { - enable_ime(); - } else { - // this implies enable_ime() and ensures that the ime mode is always - // restored when closing the dialog if at least filtered once - filter_sentry.emplace(); - } } else if( action == "RESET_FILTER" ) { filter_str.clear(); filter.text( filter_str ); diff --git a/src/mutation_ui.cpp b/src/mutation_ui.cpp index af7471189fecc..6c3446eb2e456 100644 --- a/src/mutation_ui.cpp +++ b/src/mutation_ui.cpp @@ -170,7 +170,7 @@ void player::power_mutations() } ); ui.mark_resize(); - input_context ctxt( "MUTATIONS" ); + input_context ctxt( "MUTATIONS", keyboard_mode::keychar ); ctxt.register_updown(); ctxt.register_action( "ANY_INPUT" ); ctxt.register_action( "TOGGLE_EXAMINE" ); @@ -276,7 +276,7 @@ void player::power_mutations() bool handled = false; const std::string action = ctxt.handle_input(); const input_event evt = ctxt.get_raw_input(); - if( evt.type == input_event_t::keyboard && !evt.sequence.empty() ) { + if( evt.type == input_event_t::keyboard_char && !evt.sequence.empty() ) { const int ch = evt.get_first_input(); const trait_id mut_id = trait_by_invlet( ch ); if( !mut_id.is_null() ) { @@ -286,6 +286,7 @@ void player::power_mutations() query_popup pop; pop.message( _( "%s; enter new letter." ), mutation_branch::get_name( mut_id ) ) + .preferred_keyboard_mode( keyboard_mode::keychar ) .context( "POPUP_WAIT" ) .allow_cancel( true ) .allow_anykey( true ); @@ -294,7 +295,7 @@ void player::power_mutations() while( !pop_exit ) { const query_popup::result ret = pop.query(); bool pop_handled = false; - if( ret.evt.type == input_event_t::keyboard && !ret.evt.sequence.empty() ) { + if( ret.evt.type == input_event_t::keyboard_char && !ret.evt.sequence.empty() ) { const int newch = ret.evt.get_first_input(); if( mutation_chars.valid( newch ) ) { const trait_id other_mut_id = trait_by_invlet( newch ); @@ -311,7 +312,7 @@ void player::power_mutations() if( ret.action == "QUIT" ) { pop_exit = true; } else if( ret.action != "HELP_KEYBINDINGS" && - ret.evt.type == input_event_t::keyboard ) { + ret.evt.type == input_event_t::keyboard_char ) { popup( _( "Invalid mutation letter. Only those characters are valid:\n\n%s" ), mutation_chars.get_allowed_chars() ); } diff --git a/src/ncurses_def.cpp b/src/ncurses_def.cpp index 7b99bd96dcba7..266854d811690 100644 --- a/src/ncurses_def.cpp +++ b/src/ncurses_def.cpp @@ -247,7 +247,9 @@ void catacurses::init_interface() init_colors(); } -input_event input_manager::get_input_event() +// there isn't a portable way to get raw key code on curses, +// ignoring preferred keyboard mode +input_event input_manager::get_input_event( const keyboard_mode /*preferred_keyboard_mode*/ ) { int key = ERR; input_event rval; @@ -304,9 +306,9 @@ input_event input_manager::get_input_event() } else { if( key == 127 ) { // == Unicode DELETE previously_pressed_key = KEY_BACKSPACE; - return input_event( KEY_BACKSPACE, input_event_t::keyboard ); + return input_event( KEY_BACKSPACE, input_event_t::keyboard_char ); } - rval.type = input_event_t::keyboard; + rval.type = input_event_t::keyboard_char; rval.text.append( 1, static_cast( key ) ); // Read the UTF-8 sequence (if any) if( key < 127 ) { @@ -324,7 +326,7 @@ input_event input_manager::get_input_event() // Other control character, etc. - no text at all, return an event // without the text property previously_pressed_key = key; - return input_event( key, input_event_t::keyboard ); + return input_event( key, input_event_t::keyboard_char ); } // Now we have loaded an UTF-8 sequence (possibly several bytes) // but we should only return *one* key, so return the code point of it. @@ -333,7 +335,7 @@ input_event input_manager::get_input_event() // Invalid UTF-8 sequence, this should never happen, what now? // Maybe return any error instead? previously_pressed_key = key; - return input_event( key, input_event_t::keyboard ); + return input_event( key, input_event_t::keyboard_char ); } previously_pressed_key = cp; // for compatibility only add the first byte, not the code point diff --git a/src/newcharacter.cpp b/src/newcharacter.cpp index d55870098cb58..1a74dbdeb9da8 100644 --- a/src/newcharacter.cpp +++ b/src/newcharacter.cpp @@ -25,7 +25,6 @@ #include "color.h" #include "cursesdef.h" #include "game_constants.h" -#include "ime.h" #include "input.h" #include "int_id.h" #include "inventory.h" @@ -140,7 +139,7 @@ static matype_id choose_ma_style( const character_type type, const std::vector get_hotkeys( const std::string &s ) int popup( const std::string &text, PopupFlags flags ) { query_popup pop; + pop.preferred_keyboard_mode( keyboard_mode::keychar ); pop.message( "%s", text ); if( flags & PF_GET_KEY ) { pop.allow_anykey( true ); @@ -751,7 +753,7 @@ int popup( const std::string &text, PopupFlags flags ) pop.context( "POPUP_WAIT" ); const auto &res = pop.query(); - if( res.evt.type == input_event_t::keyboard ) { + if( res.evt.type == input_event_t::keyboard_char ) { return res.evt.get_first_input(); } else { return UNKNOWN_UNICODE; @@ -1021,7 +1023,7 @@ input_event draw_item_info( const std::function &init_wind redraw(); } ); - input_context ctxt; + input_context ctxt( "default", keyboard_mode::keychar ); if( data.handle_scrolling ) { ctxt.register_action( "PAGE_UP" ); ctxt.register_action( "PAGE_DOWN" ); diff --git a/src/overmap_ui.cpp b/src/overmap_ui.cpp index 774a680bbf72f..d8efd1df5f94e 100644 --- a/src/overmap_ui.cpp +++ b/src/overmap_ui.cpp @@ -30,7 +30,6 @@ #include "game.h" #include "game_constants.h" #include "game_ui.h" -#include "ime.h" #include "input.h" #include "int_id.h" #include "line.h" @@ -431,7 +430,7 @@ static point_abs_omt draw_notes( const tripoint_abs_omt &origin ) nmenu.additional_actions.emplace_back( "DELETE_NOTE", translation() ); nmenu.additional_actions.emplace_back( "EDIT_NOTE", translation() ); nmenu.additional_actions.emplace_back( "MARK_DANGER", translation() ); - const input_context ctxt( nmenu.input_category ); + const input_context ctxt( nmenu.input_category, keyboard_mode::keychar ); nmenu.text = string_format( _( "<%s> - center on note, <%s> - edit note, <%s> - mark as dangerous, <%s> - delete note, <%s> - close window" ), colorize( "RETURN", c_yellow ), @@ -1138,9 +1137,6 @@ void create_note( const tripoint_abs_omt &curs ) update_note_preview( new_note, map_around, preview_windows ); } ); - // this implies enable_ime() and ensures that ime mode is always restored on return - ime_sentry sentry; - bool esc_pressed = false; string_input_popup input_popup; input_popup @@ -1164,8 +1160,6 @@ void create_note( const tripoint_abs_omt &curs ) } } while( true ); - disable_ime(); - if( !esc_pressed && new_note.empty() && !old_note.empty() ) { if( query_yn( _( "Really delete note?" ) ) ) { overmap_buffer.delete_note( curs ); diff --git a/src/pickup.cpp b/src/pickup.cpp index a5882365ca207..a26f3fbb86503 100644 --- a/src/pickup.cpp +++ b/src/pickup.cpp @@ -178,6 +178,7 @@ bool Pickup::query_thief() const auto &allow_key = force_uc ? input_context::disallow_lower_case : input_context::allow_all_keys; std::string answer = query_popup() + .preferred_keyboard_mode( keyboard_mode::keychar ) .allow_cancel( false ) .context( "YES_NO_ALWAYS_NEVER" ) .message( "%s", force_uc @@ -608,7 +609,7 @@ void Pickup::pick_up( const tripoint &p, int min, from_where get_items_from ) std::string action; int raw_input_char = ' '; - input_context ctxt( "PICKUP" ); + input_context ctxt( "PICKUP", keyboard_mode::keychar ); ctxt.register_action( "UP" ); ctxt.register_action( "DOWN" ); ctxt.register_action( "RIGHT" ); diff --git a/src/player.cpp b/src/player.cpp index d41d148fdf25b..3b62765bf8734 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -2224,7 +2224,7 @@ bool character_martial_arts::pick_style( const avatar &you ) // Style selection bio_cqb ) ? bio_cqb_styles : ma_styles; - input_context ctxt( "MELEE_STYLE_PICKER" ); + input_context ctxt( "MELEE_STYLE_PICKER", keyboard_mode::keychar ); ctxt.register_action( "SHOW_DESCRIPTION" ); uilist kmenu; diff --git a/src/popup.cpp b/src/popup.cpp index 9ccacdb66041e..e02d4b236e051 100644 --- a/src/popup.cpp +++ b/src/popup.cpp @@ -5,7 +5,6 @@ #include #include "catacharset.h" -#include "ime.h" #include "input.h" #include "output.h" #include "ui_manager.h" @@ -14,7 +13,7 @@ extern bool test_mode; query_popup::query_popup() : cur( 0 ), default_text_color( c_white ), anykey( false ), cancel( false ), ontop( false ), - fullscr( false ) + fullscr( false ), pref_kbd_mode( keyboard_mode::keycode ) { } @@ -83,12 +82,20 @@ query_popup &query_popup::default_color( const nc_color &d_color ) return *this; } +query_popup &query_popup::preferred_keyboard_mode( const keyboard_mode mode ) +{ + invalidate_ui(); + pref_kbd_mode = mode; + return *this; +} + std::vector> query_popup::fold_query( const std::string &category, + const keyboard_mode pref_kbd_mode, const std::vector &options, const int max_width, const int horz_padding ) { - input_context ctxt( category ); + input_context ctxt( category, pref_kbd_mode ); std::vector> folded_query; folded_query.emplace_back(); @@ -152,7 +159,8 @@ void query_popup::init() const folded_msg = foldstring( text, max_line_width ); // Fold query buttons - const auto &folded_query = fold_query( category, options, max_line_width, horz_padding ); + const auto &folded_query = fold_query( category, pref_kbd_mode, options, max_line_width, + horz_padding ); // Calculate size of message part int msg_width = 0; @@ -269,7 +277,7 @@ query_popup::result query_popup::query_once() ui_manager::redraw(); - input_context ctxt( category ); + input_context ctxt( category, pref_kbd_mode ); if( cancel || !options.empty() ) { ctxt.register_action( "HELP_KEYBINDINGS" ); } @@ -300,7 +308,7 @@ query_popup::result query_popup::query_once() // Always ignore mouse movement ( res.evt.type == input_event_t::mouse && res.evt.get_first_input() == MOUSE_MOVE ) || // Ignore window losing focus in SDL - ( res.evt.type == input_event_t::keyboard && res.evt.sequence.empty() ) + ( res.evt.type == input_event_t::keyboard_char && res.evt.sequence.empty() ) ); if( cancel && res.action == "QUIT" ) { @@ -342,8 +350,6 @@ query_popup::result query_popup::query_once() query_popup::result query_popup::query() { - ime_sentry sentry( ime_sentry::disable ); - std::shared_ptr ui = create_or_get_adaptor(); result res; diff --git a/src/popup.h b/src/popup.h index 6a28cba765f60..2906b96c6723a 100644 --- a/src/popup.h +++ b/src/popup.h @@ -173,6 +173,11 @@ class query_popup * Specify the default message color. **/ query_popup &default_color( const nc_color &d_color ); + /** + * Specify the desired keyboard mode. Used in keybindings menu to assign + * actions to input events of the approriate type of the parent UI. + */ + query_popup &preferred_keyboard_mode( keyboard_mode mode ); /** * Draw the UI. An input context should be provided using `context()` @@ -216,6 +221,7 @@ class query_popup bool cancel; bool ontop; bool fullscr; + keyboard_mode pref_kbd_mode; struct button { button( const std::string &text, const point & ); @@ -233,6 +239,7 @@ class query_popup static std::vector> fold_query( const std::string &category, + keyboard_mode pref_kbd_mode, const std::vector &options, int max_width, int horz_padding ); void invalidate_ui() const; diff --git a/src/ranged.cpp b/src/ranged.cpp index 73cdafb061527..e00ff3ee13765 100644 --- a/src/ranged.cpp +++ b/src/ranged.cpp @@ -2121,7 +2121,7 @@ void target_ui::init_window_and_input() w_target = catacurses::newwin( height, width, point( TERMX - width, top ) ); - ctxt = input_context( "TARGET" ); + ctxt = input_context( "TARGET", keyboard_mode::keychar ); ctxt.set_iso( true ); // "ANY_INPUT" should be added before any real help strings // Or strings will be written on window border. diff --git a/src/savegame.cpp b/src/savegame.cpp index e7132105ee42e..e2358af93bf6d 100644 --- a/src/savegame.cpp +++ b/src/savegame.cpp @@ -283,7 +283,7 @@ void game::load_shortcuts( std::istream &fin ) for( const JsonMember &member : data.get_object( "quick_shortcuts" ) ) { std::list &qslist = quick_shortcuts_map[member.name()]; for( const int i : member.get_array() ) { - qslist.push_back( input_event( i, input_event_t::keyboard ) ); + qslist.push_back( input_event( i, input_event_t::keyboard_char ) ); } } } diff --git a/src/sdltiles.cpp b/src/sdltiles.cpp index d56015a77480a..ed2423eb7e8dd 100644 --- a/src/sdltiles.cpp +++ b/src/sdltiles.cpp @@ -1697,6 +1697,32 @@ static int sdl_keysym_to_curses( const SDL_Keysym &keysym ) } } +static input_event sdl_keysym_to_keycode_evt( const SDL_Keysym &keysym ) +{ + switch( keysym.sym ) { + case SDLK_LCTRL: + case SDLK_LSHIFT: + case SDLK_LALT: + case SDLK_RCTRL: + case SDLK_RSHIFT: + case SDLK_RALT: + return input_event(); + } + input_event evt; + evt.type = input_event_t::keyboard_code; + if( keysym.mod & KMOD_CTRL ) { + evt.modifiers.emplace( keymod_t::ctrl ); + } + if( keysym.mod & KMOD_ALT ) { + evt.modifiers.emplace( keymod_t::alt ); + } + if( keysym.mod & KMOD_SHIFT ) { + evt.modifiers.emplace( keymod_t::shift ); + } + evt.sequence.emplace_back( keysym.sym ); + return evt; +} + bool handle_resize( int w, int h ) { if( ( w != WindowWidth ) || ( h != WindowHeight ) ) { @@ -1952,7 +1978,7 @@ int choose_best_key_for_action( const std::string &action, const std::string &ca const std::vector &events = inp_mngr.get_input_for_action( action, category ); int best_key = -1; for( const auto &events_event : events ) { - if( events_event.type == input_event_t::keyboard && events_event.sequence.size() == 1 ) { + if( events_event.type == input_event_t::keyboard_char && events_event.sequence.size() == 1 ) { bool is_ascii_char = isprint( events_event.sequence.front() ) && events_event.sequence.front() < 0xFF; bool is_best_ascii_char = best_key >= 0 && isprint( best_key ) && best_key < 0xFF; @@ -1968,7 +1994,7 @@ bool add_key_to_quick_shortcuts( int key, const std::string &category, bool back { if( key > 0 ) { quick_shortcuts_t &qsl = quick_shortcuts_map[get_quick_shortcut_name( category )]; - input_event event = input_event( key, input_event_t::keyboard ); + input_event event = input_event( key, input_event_t::keyboard_char ); quick_shortcuts_t::iterator it = std::find( qsl.begin(), qsl.end(), event ); if( it != qsl.end() ) { // already exists ( *it ).shortcut_last_used_action_counter = @@ -2142,7 +2168,7 @@ void draw_quick_shortcuts() std::vector ®istered_manual_keys = touch_input_context.get_registered_manual_keys(); for( const auto &manual_key : registered_manual_keys ) { - input_event event( manual_key.key, input_event_t::keyboard ); + input_event event( manual_key.key, input_event_t::keyboard_char ); add_quick_shortcut( qsl, event, !shortcut_right, true ); } } @@ -2385,19 +2411,19 @@ void handle_finger_input( uint32_t ticks ) WindowHeight ) ) ) { if( !handle_diagonals ) { if( delta_x >= 0 && delta_y >= 0 ) { - last_input = input_event( delta_x > delta_y ? KEY_RIGHT : KEY_DOWN, input_event_t::keyboard ); + last_input = input_event( delta_x > delta_y ? KEY_RIGHT : KEY_DOWN, input_event_t::keyboard_char ); } else if( delta_x < 0 && delta_y >= 0 ) { - last_input = input_event( -delta_x > delta_y ? KEY_LEFT : KEY_DOWN, input_event_t::keyboard ); + last_input = input_event( -delta_x > delta_y ? KEY_LEFT : KEY_DOWN, input_event_t::keyboard_char ); } else if( delta_x >= 0 && delta_y < 0 ) { - last_input = input_event( delta_x > -delta_y ? KEY_RIGHT : KEY_UP, input_event_t::keyboard ); + last_input = input_event( delta_x > -delta_y ? KEY_RIGHT : KEY_UP, input_event_t::keyboard_char ); } else if( delta_x < 0 && delta_y < 0 ) { - last_input = input_event( -delta_x > -delta_y ? KEY_LEFT : KEY_UP, input_event_t::keyboard ); + last_input = input_event( -delta_x > -delta_y ? KEY_LEFT : KEY_UP, input_event_t::keyboard_char ); } } else { if( delta_x > 0 ) { if( std::abs( delta_y ) < delta_x * 0.5f ) { // swipe right - last_input = input_event( KEY_RIGHT, input_event_t::keyboard ); + last_input = input_event( KEY_RIGHT, input_event_t::keyboard_char ); } else if( std::abs( delta_y ) < delta_x * 2.0f ) { if( delta_y < 0 ) { // swipe up-right @@ -2409,16 +2435,16 @@ void handle_finger_input( uint32_t ticks ) } else { if( delta_y < 0 ) { // swipe up - last_input = input_event( KEY_UP, input_event_t::keyboard ); + last_input = input_event( KEY_UP, input_event_t::keyboard_char ); } else { // swipe down - last_input = input_event( KEY_DOWN, input_event_t::keyboard ); + last_input = input_event( KEY_DOWN, input_event_t::keyboard_char ); } } } else { if( std::abs( delta_y ) < -delta_x * 0.5f ) { // swipe left - last_input = input_event( KEY_LEFT, input_event_t::keyboard ); + last_input = input_event( KEY_LEFT, input_event_t::keyboard_char ); } else if( std::abs( delta_y ) < -delta_x * 2.0f ) { if( delta_y < 0 ) { // swipe up-left @@ -2431,10 +2457,10 @@ void handle_finger_input( uint32_t ticks ) } else { if( delta_y < 0 ) { // swipe up - last_input = input_event( KEY_UP, input_event_t::keyboard ); + last_input = input_event( KEY_UP, input_event_t::keyboard_char ); } else { // swipe down - last_input = input_event( KEY_DOWN, input_event_t::keyboard ); + last_input = input_event( KEY_DOWN, input_event_t::keyboard_char ); } } } @@ -2446,13 +2472,13 @@ void handle_finger_input( uint32_t ticks ) // We only allow repeats for waiting, not confirming in menus as that's a bit silly if( is_default_mode ) { last_input = input_event( get_key_event_from_string( get_option( "ANDROID_TAP_KEY" ) ), - input_event_t::keyboard ); + input_event_t::keyboard_char ); } } else { if( last_tap_time > 0 && ticks - last_tap_time < static_cast( get_option( "ANDROID_INITIAL_DELAY" ) ) ) { // Double tap - last_input = input_event( is_default_mode ? KEY_ESCAPE : KEY_ESCAPE, input_event_t::keyboard ); + last_input = input_event( is_default_mode ? KEY_ESCAPE : KEY_ESCAPE, input_event_t::keyboard_char ); last_tap_time = 0; } else { // First tap detected, waiting to decide whether it's a single or a double tap input @@ -2769,7 +2795,7 @@ static void CheckMessages() // Single tap last_tap_time = ticks; last_input = input_event( is_default_mode ? get_key_event_from_string( - get_option( "ANDROID_TAP_KEY" ) ) : '\n', input_event_t::keyboard ); + get_option( "ANDROID_TAP_KEY" ) ) : '\n', input_event_t::keyboard_char ); last_tap_time = 0; return; } @@ -2859,34 +2885,45 @@ static void CheckMessages() if( get_option( "HIDE_CURSOR" ) != "show" && SDL_ShowCursor( -1 ) ) { SDL_ShowCursor( SDL_DISABLE ); } - const int lc = sdl_keysym_to_curses( ev.key.keysym ); - if( lc <= 0 ) { - // a key we don't know in curses and won't handle. - break; - } else if( add_alt_code( lc ) ) { - // key was handled - } else { - last_input = input_event( lc, input_event_t::keyboard ); + keyboard_mode mode = keyboard_mode::keychar; +#if !defined( __ANDROID__ ) + if( !SDL_IsTextInputActive() ) { + mode = keyboard_mode::keycode; + } +#endif + if( mode == keyboard_mode::keychar ) { + const int lc = sdl_keysym_to_curses( ev.key.keysym ); + if( lc <= 0 ) { + // a key we don't know in curses and won't handle. + break; + } else if( add_alt_code( lc ) ) { + // key was handled + } else { + last_input = input_event( lc, input_event_t::keyboard_char ); #if defined(__ANDROID__) - if( !android_is_hardware_keyboard_available() ) { - if( !is_string_input( touch_input_context ) && !touch_input_context.allow_text_entry ) { - if( get_option( "ANDROID_AUTO_KEYBOARD" ) ) { - SDL_StopTextInput(); - } + if( !android_is_hardware_keyboard_available() ) { + if( !is_string_input( touch_input_context ) && !touch_input_context.allow_text_entry ) { + if( get_option( "ANDROID_AUTO_KEYBOARD" ) ) { + SDL_StopTextInput(); + } - // add a quick shortcut - if( !last_input.text.empty() || !inp_mngr.get_keyname( lc, input_event_t::keyboard ).empty() ) { - qsl.remove( last_input ); - add_quick_shortcut( qsl, last_input, false, true ); - refresh_display(); - } - } else if( lc == '\n' || lc == KEY_ESCAPE ) { - if( get_option( "ANDROID_AUTO_KEYBOARD" ) ) { - SDL_StopTextInput(); + // add a quick shortcut + if( !last_input.text.empty() || + !inp_mngr.get_keyname( lc, input_event_t::keyboard_char ).empty() ) { + qsl.remove( last_input ); + add_quick_shortcut( qsl, last_input, false, true ); + refresh_display(); + } + } else if( lc == '\n' || lc == KEY_ESCAPE ) { + if( get_option( "ANDROID_AUTO_KEYBOARD" ) ) { + SDL_StopTextInput(); + } } } - } #endif + } + } else { + last_input = sdl_keysym_to_keycode_evt( ev.key.keysym ); } } break; @@ -2904,14 +2941,24 @@ static void CheckMessages() } ac_back_down_time = 0; } +#endif + keyboard_mode mode = keyboard_mode::keychar; +#if !defined( __ANDROID__ ) + if( !SDL_IsTextInputActive() ) { + mode = keyboard_mode::keycode; + } #endif is_repeat = ev.key.repeat; - if( ev.key.keysym.sym == SDLK_LALT || ev.key.keysym.sym == SDLK_RALT ) { - int code = end_alt_code(); - if( code ) { - last_input = input_event( code, input_event_t::keyboard ); - last_input.text = utf32_to_utf8( code ); + if( mode == keyboard_mode::keychar ) { + if( ev.key.keysym.sym == SDLK_LALT || ev.key.keysym.sym == SDLK_RALT ) { + int code = end_alt_code(); + if( code ) { + last_input = input_event( code, input_event_t::keyboard_char ); + last_input.text = utf32_to_utf8( code ); + } } + } else if( is_repeat ) { + last_input = sdl_keysym_to_keycode_evt( ev.key.keysym ); } } break; @@ -2919,7 +2966,7 @@ static void CheckMessages() if( !add_alt_code( *ev.text.text ) ) { if( strlen( ev.text.text ) > 0 ) { const unsigned lc = UTF8_getch( ev.text.text ); - last_input = input_event( lc, input_event_t::keyboard ); + last_input = input_event( lc, input_event_t::keyboard_char ); #if defined(__ANDROID__) if( !android_is_hardware_keyboard_available() ) { if( !is_string_input( touch_input_context ) && !touch_input_context.allow_text_entry ) { @@ -2942,7 +2989,7 @@ static void CheckMessages() } else { // no key pressed in this event last_input = input_event(); - last_input.type = input_event_t::keyboard; + last_input.type = input_event_t::keyboard_char; } last_input.text = ev.text.text; text_refresh = true; @@ -2951,11 +2998,11 @@ static void CheckMessages() case SDL_TEXTEDITING: { if( strlen( ev.edit.text ) > 0 ) { const unsigned lc = UTF8_getch( ev.edit.text ); - last_input = input_event( lc, input_event_t::keyboard ); + last_input = input_event( lc, input_event_t::keyboard_char ); } else { // no key pressed in this event last_input = input_event(); - last_input.type = input_event_t::keyboard; + last_input.type = input_event_t::keyboard_char; } last_input.edit = ev.edit.text; last_input.edit_refresh = true; @@ -2963,7 +3010,7 @@ static void CheckMessages() } break; case SDL_JOYBUTTONDOWN: - last_input = input_event( ev.jbutton.button, input_event_t::keyboard ); + last_input = input_event( ev.jbutton.button, input_event_t::keyboard_char ); break; case SDL_JOYAXISMOTION: // on gamepads, the axes are the analog sticks @@ -3092,7 +3139,7 @@ static void CheckMessages() if( std::max( d1, d2 ) < get_option( "ANDROID_DEADZONE_RANGE" ) * longest_window_edge ) { last_input = input_event( get_key_event_from_string( - get_option( "ANDROID_2_TAP_KEY" ) ), input_event_t::keyboard ); + get_option( "ANDROID_2_TAP_KEY" ) ), input_event_t::keyboard_char ); } else { float dot = ( x1 * x2 + y1 * y2 ) / ( d1 * d2 ); // dot product of two finger vectors, -1 to +1 if( dot > 0.0f ) { // both fingers mostly heading in same direction, check for double-finger swipe gesture @@ -3105,16 +3152,16 @@ static void CheckMessages() float yavg = 0.5f * ( y1 + y2 ); if( xavg > 0 && xavg > std::abs( yavg ) ) { last_input = input_event( get_key_event_from_string( - get_option( "ANDROID_2_SWIPE_LEFT_KEY" ) ), input_event_t::keyboard ); + get_option( "ANDROID_2_SWIPE_LEFT_KEY" ) ), input_event_t::keyboard_char ); } else if( xavg < 0 && -xavg > std::abs( yavg ) ) { last_input = input_event( get_key_event_from_string( - get_option( "ANDROID_2_SWIPE_RIGHT_KEY" ) ), input_event_t::keyboard ); + get_option( "ANDROID_2_SWIPE_RIGHT_KEY" ) ), input_event_t::keyboard_char ); } else if( yavg > 0 && yavg > std::abs( xavg ) ) { last_input = input_event( get_key_event_from_string( - get_option( "ANDROID_2_SWIPE_DOWN_KEY" ) ), input_event_t::keyboard ); + get_option( "ANDROID_2_SWIPE_DOWN_KEY" ) ), input_event_t::keyboard_char ); } else { last_input = input_event( get_key_event_from_string( - get_option( "ANDROID_2_SWIPE_UP_KEY" ) ), input_event_t::keyboard ); + get_option( "ANDROID_2_SWIPE_UP_KEY" ) ), input_event_t::keyboard_char ); } } } else { @@ -3130,10 +3177,10 @@ static void CheckMessages() const float zoom_ratio = 0.9f; if( curr_dist < down_dist * zoom_ratio ) { last_input = input_event( get_key_event_from_string( - get_option( "ANDROID_PINCH_IN_KEY" ) ), input_event_t::keyboard ); + get_option( "ANDROID_PINCH_IN_KEY" ) ), input_event_t::keyboard_char ); } else if( curr_dist > down_dist / zoom_ratio ) { last_input = input_event( get_key_event_from_string( - get_option( "ANDROID_PINCH_OUT_KEY" ) ), input_event_t::keyboard ); + get_option( "ANDROID_PINCH_OUT_KEY" ) ), input_event_t::keyboard_char ); } } } @@ -3604,8 +3651,19 @@ void input_manager::set_timeout( const int t ) // This is how we're actually going to handle input events, SDL getch // is simply a wrapper around this. -input_event input_manager::get_input_event() +input_event input_manager::get_input_event( const keyboard_mode preferred_keyboard_mode ) { +#if !defined( __ANDROID__ ) + if( preferred_keyboard_mode == keyboard_mode::keychar ) { + SDL_StartTextInput(); + } else { + SDL_StopTextInput(); + } +#else + // TODO: support keycode mode if hardware keyboard is connected? + ( void ) preferred_keyboard_mode; +#endif + previously_pressed_key = 0; // standards note: getch is sometimes required to call refresh // see, e.g., http://linux.die.net/man/3/getch @@ -3643,7 +3701,7 @@ input_event input_manager::get_input_event() if( last_input.type == input_event_t::mouse ) { SDL_GetMouseState( &last_input.mouse_pos.x, &last_input.mouse_pos.y ); - } else if( last_input.type == input_event_t::keyboard ) { + } else if( last_input.type == input_event_t::keyboard_char ) { previously_pressed_key = last_input.get_first_input(); #if defined(__ANDROID__) android_vibrate(); diff --git a/src/string_input_popup.cpp b/src/string_input_popup.cpp index 6bf4a2dac3990..17e95d7b82275 100644 --- a/src/string_input_popup.cpp +++ b/src/string_input_popup.cpp @@ -4,7 +4,6 @@ #include "catacharset.h" #include "compatibility.h" // needed for the workaround for the std::to_string bug in some compilers -#include "ime.h" #include "input.h" #include "optional.h" #include "output.h" @@ -87,7 +86,7 @@ void string_input_popup::create_window() void string_input_popup::create_context() { - ctxt_ptr = std::make_unique( "STRING_INPUT" ); + ctxt_ptr = std::make_unique( "STRING_INPUT", keyboard_mode::keychar ); ctxt = ctxt_ptr.get(); ctxt->register_action( "ANY_INPUT" ); } @@ -299,10 +298,6 @@ const std::string &string_input_popup::query_string( const bool loop, const bool create_context(); } - cata::optional sentry; - if( !draw_only && loop ) { - sentry.emplace(); - } utf8_wrapper ret( _text ); utf8_wrapper edit( ctxt->get_edittext() ); if( _position == -1 ) { @@ -371,7 +366,7 @@ const std::string &string_input_popup::query_string( const bool loop, const bool const std::string action = ctxt->handle_input(); const input_event ev = ctxt->get_raw_input(); - ch = ev.type == input_event_t::keyboard ? ev.get_first_input() : 0; + ch = ev.type == input_event_t::keyboard_char ? ev.get_first_input() : 0; if( callbacks[ch] ) { if( callbacks[ch]() ) { diff --git a/src/ui.cpp b/src/ui.cpp index 0f344af8d2e90..e245da9aa371f 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -13,7 +13,6 @@ #include "catacharset.h" #include "debug.h" #include "game.h" -#include "ime.h" #include "input.h" #include "output.h" #include "player.h" @@ -255,7 +254,7 @@ void uilist::filterlist() void uilist::inputfilter() { - input_context ctxt( input_category ); + input_context ctxt( input_category, keyboard_mode::keychar ); ctxt.register_updown(); ctxt.register_action( "PAGE_UP" ); ctxt.register_action( "PAGE_DOWN" ); @@ -266,7 +265,6 @@ void uilist::inputfilter() filter_popup->context( ctxt ).text( filter ) .max_length( 256 ) .window( window, point( 4, w_height - 1 ), w_width - 4 ); - ime_sentry sentry; do { ui_manager::redraw(); filter = filter_popup->query_string( false ); @@ -781,7 +779,7 @@ void uilist::query( bool loop, int timeout ) } ret = UILIST_WAIT_INPUT; - input_context ctxt( input_category ); + input_context ctxt( input_category, keyboard_mode::keychar ); ctxt.register_updown(); ctxt.register_action( "PAGE_UP" ); ctxt.register_action( "PAGE_DOWN" ); diff --git a/src/veh_interact.cpp b/src/veh_interact.cpp index 9980fc2b07f0c..ffc6a3d9e4e05 100644 --- a/src/veh_interact.cpp +++ b/src/veh_interact.cpp @@ -204,7 +204,7 @@ vehicle_part &veh_interact::select_part( const vehicle &veh, const part_selector * Creates a blank veh_interact window. */ veh_interact::veh_interact( vehicle &veh, const point &p ) - : dd( p ), veh( &veh ), main_context( "VEH_INTERACT" ) + : dd( p ), veh( &veh ), main_context( "VEH_INTERACT", keyboard_mode::keychar ) { // Only build the shapes map and the wheel list once for( const auto &e : vpart_info::all() ) { diff --git a/src/vehicle_use.cpp b/src/vehicle_use.cpp index bc9cef98f3d72..adcc8de3e2559 100644 --- a/src/vehicle_use.cpp +++ b/src/vehicle_use.cpp @@ -93,7 +93,7 @@ enum change_types : int { char keybind( const std::string &opt, const std::string &context ) { - const auto keys = input_context( context ).keys_bound_to( opt ); + const auto keys = input_context( context, keyboard_mode::keychar ).keys_bound_to( opt ); return keys.empty() ? ' ' : keys.front(); } diff --git a/src/wincurse.cpp b/src/wincurse.cpp index ec4dad4ced5f8..ab9c88f68b842 100644 --- a/src/wincurse.cpp +++ b/src/wincurse.cpp @@ -558,7 +558,7 @@ static void CheckMessages() DispatchMessage( &msg ); } if( needs_resize ) { - restore_on_out_of_scope prev_lastchar( lastchar ); + restore_on_out_of_scope prev_lastchar( lastchar ); handle_resize( 0, 0 ); refresh_display(); } @@ -663,7 +663,9 @@ static uint64_t GetPerfCount() return Count; } -input_event input_manager::get_input_event() +// we can probably add support for keycode mode, but wincurse is deprecated +// so we just ignore the mode argument. +input_event input_manager::get_input_event( const keyboard_mode /*preferred_keyboard_mode*/ ) { // standards note: getch is sometimes required to call refresh // see, e.g., http://linux.die.net/man/3/getch @@ -707,9 +709,9 @@ input_event input_manager::get_input_event() // == Unicode DELETE if( lastchar == 127 ) { previously_pressed_key = KEY_BACKSPACE; - return input_event( KEY_BACKSPACE, input_event_t::keyboard ); + return input_event( KEY_BACKSPACE, input_event_t::keyboard_char ); } - rval.type = input_event_t::keyboard; + rval.type = input_event_t::keyboard_char; rval.text = utf32_to_utf8( lastchar ); previously_pressed_key = lastchar; // for compatibility only add the first byte, not the code point diff --git a/src/wish.cpp b/src/wish.cpp index 28284f0a2b7d3..c36cf10bcc269 100644 --- a/src/wish.cpp +++ b/src/wish.cpp @@ -197,7 +197,7 @@ class wish_mutate_callback: public uilist_callback mvwprintz( menu->window, point( startx, menu->w_height - 3 ), c_green, msg ); msg.clear(); - input_context ctxt( menu->input_category ); + input_context ctxt( menu->input_category, keyboard_mode::keychar ); mvwprintw( menu->window, point( startx, menu->w_height - 2 ), _( "[%s] find, [%s] quit, [t] toggle base trait" ), ctxt.get_desc( "FILTER" ), ctxt.get_desc( "QUIT" ) ); @@ -366,7 +366,7 @@ class wish_monster_callback: public uilist_callback mvwprintz( w_info, point( 0, getmaxy( w_info ) - 3 ), c_green, msg ); msg.clear(); - input_context ctxt( menu->input_category ); + input_context ctxt( menu->input_category, keyboard_mode::keychar ); mvwprintw( w_info, point( 0, getmaxy( w_info ) - 2 ), _( "[%s] find, [f]riendly, [h]allucination, [i]ncrease group, [d]ecrease group, [%s] quit" ), ctxt.get_desc( "FILTER" ), ctxt.get_desc( "QUIT" ) ); @@ -422,7 +422,7 @@ void debug_menu::wishmonster( const cata::optional &p ) } ++num_spawned; } - input_context ctxt( wmenu.input_category ); + input_context ctxt( wmenu.input_category, keyboard_mode::keychar ); cb.msg = string_format( _( "Spawned %d monsters, choose another or [%s] to quit." ), num_spawned, ctxt.get_desc( "QUIT" ) ); if( num_spawned == 0 ) { @@ -505,7 +505,7 @@ class wish_item_callback: public uilist_callback mvwprintz( menu->window, point( startx, menu->w_height - 3 ), c_green, msg ); msg.erase(); - input_context ctxt( menu->input_category ); + input_context ctxt( menu->input_category, keyboard_mode::keychar ); mvwprintw( menu->window, point( startx, menu->w_height - 2 ), _( "[%s] find, [f] container, [F] flag, [E] everything, [%s] quit" ), ctxt.get_desc( "FILTER" ), ctxt.get_desc( "QUIT" ) ); @@ -615,7 +615,7 @@ void debug_menu::wishitem( player *p, const tripoint &pos ) wmenu.ret = -1; } if( amount > 0 ) { - input_context ctxt( wmenu.input_category ); + input_context ctxt( wmenu.input_category, keyboard_mode::keychar ); cb.msg = string_format( _( "Wish granted. Wish for more or hit [%s] to quit." ), ctxt.get_desc( "QUIT" ) ); } diff --git a/src/worldfactory.cpp b/src/worldfactory.cpp index 607a4e0049cae..2d2356caa4875 100644 --- a/src/worldfactory.cpp +++ b/src/worldfactory.cpp @@ -20,7 +20,6 @@ #include "enums.h" #include "filesystem.h" #include "game.h" -#include "ime.h" #include "input.h" #include "json.h" #include "mod_manager.h" @@ -1093,8 +1092,6 @@ int worldfactory::show_worldgen_tab_modselection( const catacurses::window &win, const std::string old_filter = current_filter; fpopup->text( current_filter ); - ime_sentry sentry; - // On next redraw, call resize callback which will configure how popup is rendered ui.mark_resize(); @@ -1261,7 +1258,7 @@ int worldfactory::show_worldgen_tab_confirm( const catacurses::window &win, WORL int namebar_x = 3 + utf8_width( _( "World Name:" ) ); bool noname = false; - input_context ctxt( "WORLDGEN_CONFIRM_DIALOG" ); + input_context ctxt( "WORLDGEN_CONFIRM_DIALOG", keyboard_mode::keychar ); ctxt.register_action( "HELP_KEYBINDINGS" ); ctxt.register_action( "QUIT" ); ctxt.register_action( "ANY_INPUT" ); @@ -1271,9 +1268,6 @@ int worldfactory::show_worldgen_tab_confirm( const catacurses::window &win, WORL std::string worldname = world->world_name; - // do not switch IME mode now, but restore previous mode on return - ime_sentry sentry( ime_sentry::keep ); - ui.on_redraw( [&]( const ui_adaptor & ) { draw_worldgen_tabs( win, 2 );