From 78fe3fb702542b4c5bf613c4ba1e9b54164ca321 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Mon, 4 Nov 2013 20:56:24 +1300 Subject: [PATCH] Convert Keycode to match SDL2. Fixes #4055. --- OpenRA.FileFormats/Keycode.cs | 867 ++++++++++++----------- OpenRA.Game/Widgets/HotkeyEntryWidget.cs | 2 +- 2 files changed, 439 insertions(+), 430 deletions(-) diff --git a/OpenRA.FileFormats/Keycode.cs b/OpenRA.FileFormats/Keycode.cs index bba38dbf8e..3857737397 100755 --- a/OpenRA.FileFormats/Keycode.cs +++ b/OpenRA.FileFormats/Keycode.cs @@ -14,259 +14,261 @@ using System.Linq; namespace OpenRA { + // List of keycodes, duplicated from SDL 2.0.1 public enum Keycode { UNKNOWN = 0, - FIRST = 0, - BACKSPACE = 8, - TAB = 9, - CLEAR = 12, - RETURN = 13, - PAUSE = 19, + RETURN = '\r', ESCAPE = 27, - SPACE = 32, - EXCLAIM = 33, - QUOTEDBL = 34, - HASH = 35, - DOLLAR = 36, - AMPERSAND = 38, - QUOTE = 39, - LEFTPAREN = 40, - RIGHTPAREN = 41, - ASTERISK = 42, - PLUS = 43, - COMMA = 44, - MINUS = 45, - PERIOD = 46, - SLASH = 47, - NUMBER_0 = 48, - NUMBER_1 = 49, - NUMBER_2 = 50, - NUMBER_3 = 51, - NUMBER_4 = 52, - NUMBER_5 = 53, - NUMBER_6 = 54, - NUMBER_7 = 55, - NUMBER_8 = 56, - NUMBER_9 = 57, - COLON = 58, - SEMICOLON = 59, - LESS = 60, - EQUALS = 61, - GREATER = 62, - QUESTION = 63, - AT = 64, - LEFTBRACKET = 91, - BACKSLASH = 92, - RIGHTBRACKET = 93, - CARET = 94, - UNDERSCORE = 95, - BACKQUOTE = 96, - A = 97, - B = 98, - C = 99, - D = 100, - E = 101, - F = 102, - G = 103, - H = 104, - I = 105, - J = 106, - K = 107, - L = 108, - M = 109, - N = 110, - O = 111, - P = 112, - Q = 113, - R = 114, - S = 115, - T = 116, - U = 117, - V = 118, - W = 119, - X = 120, - Y = 121, - Z = 122, + BACKSPACE = '\b', + TAB = '\t', + SPACE = ' ', + EXCLAIM = '!', + QUOTEDBL = '"', + HASH = '#', + PERCENT = '%', + DOLLAR = '$', + AMPERSAND = '&', + QUOTE = '\'', + LEFTPAREN = '(', + RIGHTPAREN = ')', + ASTERISK = '*', + PLUS = '+', + COMMA = ',', + MINUS = '-', + PERIOD = '.', + SLASH = '/', + NUMBER_0 = '0', + NUMBER_1 = '1', + NUMBER_2 = '2', + NUMBER_3 = '3', + NUMBER_4 = '4', + NUMBER_5 = '5', + NUMBER_6 = '6', + NUMBER_7 = '7', + NUMBER_8 = '8', + NUMBER_9 = '9', + COLON = ':', + SEMICOLON = ';', + LESS = '<', + EQUALS = '=', + GREATER = '>', + QUESTION = '?', + AT = '@', + LEFTBRACKET = '[', + BACKSLASH = '\\', + RIGHTBRACKET = ']', + CARET = '^', + UNDERSCORE = '_', + BACKQUOTE = '`', + A = 'a', + B = 'b', + C = 'c', + D = 'd', + E = 'e', + F = 'f', + G = 'g', + H = 'h', + I = 'i', + J = 'j', + K = 'k', + L = 'l', + M = 'm', + N = 'n', + O = 'o', + P = 'p', + Q = 'q', + R = 'r', + S = 's', + T = 't', + U = 'u', + V = 'v', + W = 'w', + X = 'x', + Y = 'y', + Z = 'z', + CAPSLOCK = 57 | (1 << 30), + F1 = 58 | (1 << 30), + F2 = 59 | (1 << 30), + F3 = 60 | (1 << 30), + F4 = 61 | (1 << 30), + F5 = 62 | (1 << 30), + F6 = 63 | (1 << 30), + F7 = 64 | (1 << 30), + F8 = 65 | (1 << 30), + F9 = 66 | (1 << 30), + F10 = 67 | (1 << 30), + F11 = 68 | (1 << 30), + F12 = 69 | (1 << 30), + PRINTSCREEN = 70 | (1 << 30), + SCROLLLOCK = 71 | (1 << 30), + PAUSE = 72 | (1 << 30), + INSERT = 73 | (1 << 30), + HOME = 74 | (1 << 30), + PAGEUP = 75 | (1 << 30), DELETE = 127, - WORLD_0 = 160, - WORLD_1 = 161, - WORLD_2 = 162, - WORLD_3 = 163, - WORLD_4 = 164, - WORLD_5 = 165, - WORLD_6 = 166, - WORLD_7 = 167, - WORLD_8 = 168, - WORLD_9 = 169, - WORLD_10 = 170, - WORLD_11 = 171, - WORLD_12 = 172, - WORLD_13 = 173, - WORLD_14 = 174, - WORLD_15 = 175, - WORLD_16 = 176, - WORLD_17 = 177, - WORLD_18 = 178, - WORLD_19 = 179, - WORLD_20 = 180, - WORLD_21 = 181, - WORLD_22 = 182, - WORLD_23 = 183, - WORLD_24 = 184, - WORLD_25 = 185, - WORLD_26 = 186, - WORLD_27 = 187, - WORLD_28 = 188, - WORLD_29 = 189, - WORLD_30 = 190, - WORLD_31 = 191, - WORLD_32 = 192, - WORLD_33 = 193, - WORLD_34 = 194, - WORLD_35 = 195, - WORLD_36 = 196, - WORLD_37 = 197, - WORLD_38 = 198, - WORLD_39 = 199, - WORLD_40 = 200, - WORLD_41 = 201, - WORLD_42 = 202, - WORLD_43 = 203, - WORLD_44 = 204, - WORLD_45 = 205, - WORLD_46 = 206, - WORLD_47 = 207, - WORLD_48 = 208, - WORLD_49 = 209, - WORLD_50 = 210, - WORLD_51 = 211, - WORLD_52 = 212, - WORLD_53 = 213, - WORLD_54 = 214, - WORLD_55 = 215, - WORLD_56 = 216, - WORLD_57 = 217, - WORLD_58 = 218, - WORLD_59 = 219, - WORLD_60 = 220, - WORLD_61 = 221, - WORLD_62 = 222, - WORLD_63 = 223, - WORLD_64 = 224, - WORLD_65 = 225, - WORLD_66 = 226, - WORLD_67 = 227, - WORLD_68 = 228, - WORLD_69 = 229, - WORLD_70 = 230, - WORLD_71 = 231, - WORLD_72 = 232, - WORLD_73 = 233, - WORLD_74 = 234, - WORLD_75 = 235, - WORLD_76 = 236, - WORLD_77 = 237, - WORLD_78 = 238, - WORLD_79 = 239, - WORLD_80 = 240, - WORLD_81 = 241, - WORLD_82 = 242, - WORLD_83 = 243, - WORLD_84 = 244, - WORLD_85 = 245, - WORLD_86 = 246, - WORLD_87 = 247, - WORLD_88 = 248, - WORLD_89 = 249, - WORLD_90 = 250, - WORLD_91 = 251, - WORLD_92 = 252, - WORLD_93 = 253, - WORLD_94 = 254, - WORLD_95 = 255, - KP0 = 256, - KP1 = 257, - KP2 = 258, - KP3 = 259, - KP4 = 260, - KP5 = 261, - KP6 = 262, - KP7 = 263, - KP8 = 264, - KP9 = 265, - KP_PERIOD = 266, - KP_DIVIDE = 267, - KP_MULTIPLY = 268, - KP_MINUS = 269, - KP_PLUS = 270, - KP_ENTER = 271, - KP_EQUALS = 272, - UP = 273, - DOWN = 274, - RIGHT = 275, - LEFT = 276, - INSERT = 277, - HOME = 278, - END = 279, - PAGEUP = 280, - PAGEDOWN = 281, - F1 = 282, - F2 = 283, - F3 = 284, - F4 = 285, - F5 = 286, - F6 = 287, - F7 = 288, - F8 = 289, - F9 = 290, - F10 = 291, - F11 = 292, - F12 = 293, - F13 = 294, - F14 = 295, - F15 = 296, - NUMLOCK = 300, - CAPSLOCK = 301, - SCROLLOCK = 302, - RSHIFT = 303, - LSHIFT = 304, - RCTRL = 305, - LCTRL = 306, - RALT = 307, - LALT = 308, - RMETA = 309, - LMETA = 310, - LSUPER = 311, - RSUPER = 312, - MODE = 313, - COMPOSE = 314, - HELP = 315, - PRINT = 316, - SYSREQ = 317, - BREAK = 318, - MENU = 319, - POWER = 320, - EURO = 321, - UNDO = 322, - LAST + END = 77 | (1 << 30), + PAGEDOWN = 78 | (1 << 30), + RIGHT = 79 | (1 << 30), + LEFT = 80 | (1 << 30), + DOWN = 81 | (1 << 30), + UP = 82 | (1 << 30), + NUMLOCKCLEAR = 83 | (1 << 30), + KP_DIVIDE = 84 | (1 << 30), + KP_MULTIPLY = 85 | (1 << 30), + KP_MINUS = 86 | (1 << 30), + KP_PLUS = 87 | (1 << 30), + KP_ENTER = 88 | (1 << 30), + KP_1 = 89 | (1 << 30), + KP_2 = 90 | (1 << 30), + KP_3 = 91 | (1 << 30), + KP_4 = 92 | (1 << 30), + KP_5 = 93 | (1 << 30), + KP_6 = 94 | (1 << 30), + KP_7 = 95 | (1 << 30), + KP_8 = 96 | (1 << 30), + KP_9 = 97 | (1 << 30), + KP_0 = 98 | (1 << 30), + KP_PERIOD = 99 | (1 << 30), + APPLICATION = 101 | (1 << 30), + POWER = 102 | (1 << 30), + KP_EQUALS = 103 | (1 << 30), + F13 = 104 | (1 << 30), + F14 = 105 | (1 << 30), + F15 = 106 | (1 << 30), + F16 = 107 | (1 << 30), + F17 = 108 | (1 << 30), + F18 = 109 | (1 << 30), + F19 = 110 | (1 << 30), + F20 = 111 | (1 << 30), + F21 = 112 | (1 << 30), + F22 = 113 | (1 << 30), + F23 = 114 | (1 << 30), + F24 = 115 | (1 << 30), + EXECUTE = 116 | (1 << 30), + HELP = 117 | (1 << 30), + MENU = 118 | (1 << 30), + SELECT = 119 | (1 << 30), + STOP = 120 | (1 << 30), + AGAIN = 121 | (1 << 30), + UNDO = 122 | (1 << 30), + CUT = 123 | (1 << 30), + COPY = 124 | (1 << 30), + PASTE = 125 | (1 << 30), + FIND = 126 | (1 << 30), + MUTE = 127 | (1 << 30), + VOLUMEUP = 128 | (1 << 30), + VOLUMEDOWN = 129 | (1 << 30), + KP_COMMA = 133 | (1 << 30), + KP_EQUALSAS400 = 134 | (1 << 30), + ALTERASE = 153 | (1 << 30), + SYSREQ = 154 | (1 << 30), + CANCEL = 155 | (1 << 30), + CLEAR = 156 | (1 << 30), + PRIOR = 157 | (1 << 30), + RETURN2 = 158 | (1 << 30), + SEPARATOR = 159 | (1 << 30), + OUT = 160 | (1 << 30), + OPER = 161 | (1 << 30), + CLEARAGAIN = 162 | (1 << 30), + CRSEL = 163 | (1 << 30), + EXSEL = 164 | (1 << 30), + KP_00 = 176 | (1 << 30), + KP_000 = 177 | (1 << 30), + THOUSANDSSEPARATOR = 178 | (1 << 30), + DECIMALSEPARATOR = 179 | (1 << 30), + CURRENCYUNIT = 180 | (1 << 30), + CURRENCYSUBUNIT = 181 | (1 << 30), + KP_LEFTPAREN = 182 | (1 << 30), + KP_RIGHTPAREN = 183 | (1 << 30), + KP_LEFTBRACE = 184 | (1 << 30), + KP_RIGHTBRACE = 185 | (1 << 30), + KP_TAB = 186 | (1 << 30), + KP_BACKSPACE = 187 | (1 << 30), + KP_A = 188 | (1 << 30), + KP_B = 189 | (1 << 30), + KP_C = 190 | (1 << 30), + KP_D = 191 | (1 << 30), + KP_E = 192 | (1 << 30), + KP_F = 193 | (1 << 30), + KP_XOR = 194 | (1 << 30), + KP_POWER = 195 | (1 << 30), + KP_PERCENT = 196 | (1 << 30), + KP_LESS = 197 | (1 << 30), + KP_GREATER = 198 | (1 << 30), + KP_AMPERSAND = 199 | (1 << 30), + KP_DBLAMPERSAND = 200 | (1 << 30), + KP_VERTICALBAR = 201 | (1 << 30), + KP_DBLVERTICALBAR = 202 | (1 << 30), + KP_COLON = 203 | (1 << 30), + KP_HASH = 204 | (1 << 30), + KP_SPACE = 205 | (1 << 30), + KP_AT = 206 | (1 << 30), + KP_EXCLAM = 207 | (1 << 30), + KP_MEMSTORE = 208 | (1 << 30), + KP_MEMRECALL = 209 | (1 << 30), + KP_MEMCLEAR = 210 | (1 << 30), + KP_MEMADD = 211 | (1 << 30), + KP_MEMSUBTRACT = 212 | (1 << 30), + KP_MEMMULTIPLY = 213 | (1 << 30), + KP_MEMDIVIDE = 214 | (1 << 30), + KP_PLUSMINUS = 215 | (1 << 30), + KP_CLEAR = 216 | (1 << 30), + KP_CLEARENTRY = 217 | (1 << 30), + KP_BINARY = 218 | (1 << 30), + KP_OCTAL = 219 | (1 << 30), + KP_DECIMAL = 220 | (1 << 30), + KP_HEXADECIMAL = 221 | (1 << 30), + LCTRL = 224 | (1 << 30), + LSHIFT = 225 | (1 << 30), + LALT = 226 | (1 << 30), + LGUI = 227 | (1 << 30), + RCTRL = 228 | (1 << 30), + RSHIFT = 229 | (1 << 30), + RALT = 230 | (1 << 30), + RGUI = 231 | (1 << 30), + MODE = 257 | (1 << 30), + AUDIONEXT = 258 | (1 << 30), + AUDIOPREV = 259 | (1 << 30), + AUDIOSTOP = 260 | (1 << 30), + AUDIOPLAY = 261 | (1 << 30), + AUDIOMUTE = 262 | (1 << 30), + MEDIASELECT = 263 | (1 << 30), + WWW = 264 | (1 << 30), + MAIL = 265 | (1 << 30), + CALCULATOR = 266 | (1 << 30), + COMPUTER = 267 | (1 << 30), + AC_SEARCH = 268 | (1 << 30), + AC_HOME = 269 | (1 << 30), + AC_BACK = 270 | (1 << 30), + AC_FORWARD = 271 | (1 << 30), + AC_STOP = 272 | (1 << 30), + AC_REFRESH = 273 | (1 << 30), + AC_BOOKMARKS = 274 | (1 << 30), + BRIGHTNESSDOWN = 275 | (1 << 30), + BRIGHTNESSUP = 276 | (1 << 30), + DISPLAYSWITCH = 277 | (1 << 30), + KBDILLUMTOGGLE = 278 | (1 << 30), + KBDILLUMDOWN = 279 | (1 << 30), + KBDILLUMUP = 280 | (1 << 30), + EJECT = 281 | (1 << 30), + SLEEP = 282 | (1 << 30), } public static class KeycodeExts { static readonly Dictionary KeyNames = new Dictionary { - { Keycode.UNKNOWN, "unknown" }, - { Keycode.BACKSPACE, "backspace" }, - { Keycode.TAB, "tab" }, - { Keycode.CLEAR, "clear" }, - { Keycode.RETURN, "return" }, - { Keycode.PAUSE, "pause" }, - { Keycode.ESCAPE, "escape" }, - { Keycode.SPACE, "space" }, + { Keycode.UNKNOWN, "Unknown" }, + { Keycode.RETURN, "Return" }, + { Keycode.ESCAPE, "Escape" }, + { Keycode.BACKSPACE, "Backspace" }, + { Keycode.TAB, "Tab" }, + { Keycode.SPACE, "Space" }, { Keycode.EXCLAIM, "!" }, { Keycode.QUOTEDBL, "\"" }, { Keycode.HASH, "#" }, + { Keycode.PERCENT, "%" }, { Keycode.DOLLAR, "$" }, { Keycode.AMPERSAND, "&" }, { Keycode.QUOTE, "'" }, @@ -289,7 +291,7 @@ namespace OpenRA { Keycode.NUMBER_8, "8" }, { Keycode.NUMBER_9, "9" }, { Keycode.COLON, ":" }, - { Keycode.SEMICOLON, " }," }, + { Keycode.SEMICOLON, ";" }, { Keycode.LESS, "<" }, { Keycode.EQUALS, "=" }, { Keycode.GREATER, ">" }, @@ -301,199 +303,206 @@ namespace OpenRA { Keycode.CARET, "^" }, { Keycode.UNDERSCORE, "_" }, { Keycode.BACKQUOTE, "`" }, - { Keycode.A, "a" }, - { Keycode.B, "b" }, - { Keycode.C, "c" }, - { Keycode.D, "d" }, - { Keycode.E, "e" }, - { Keycode.F, "f" }, - { Keycode.G, "g" }, - { Keycode.H, "h" }, - { Keycode.I, "i" }, - { Keycode.J, "j" }, - { Keycode.K, "k" }, - { Keycode.L, "l" }, - { Keycode.M, "m" }, - { Keycode.N, "n" }, - { Keycode.O, "o" }, - { Keycode.P, "p" }, - { Keycode.Q, "q" }, - { Keycode.R, "r" }, - { Keycode.S, "s" }, - { Keycode.T, "t" }, - { Keycode.U, "u" }, - { Keycode.V, "v" }, - { Keycode.W, "w" }, - { Keycode.X, "x" }, - { Keycode.Y, "y" }, - { Keycode.Z, "z" }, - { Keycode.DELETE, "delete" }, - { Keycode.WORLD_0, "world 0" }, - { Keycode.WORLD_1, "world 1" }, - { Keycode.WORLD_2, "world 2" }, - { Keycode.WORLD_3, "world 3" }, - { Keycode.WORLD_4, "world 4" }, - { Keycode.WORLD_5, "world 5" }, - { Keycode.WORLD_6, "world 6" }, - { Keycode.WORLD_7, "world 7" }, - { Keycode.WORLD_8, "world 8" }, - { Keycode.WORLD_9, "world 9" }, - { Keycode.WORLD_10, "world 10" }, - { Keycode.WORLD_11, "world 11" }, - { Keycode.WORLD_12, "world 12" }, - { Keycode.WORLD_13, "world 13" }, - { Keycode.WORLD_14, "world 14" }, - { Keycode.WORLD_15, "world 15" }, - { Keycode.WORLD_16, "world 16" }, - { Keycode.WORLD_17, "world 17" }, - { Keycode.WORLD_18, "world 18" }, - { Keycode.WORLD_19, "world 19" }, - { Keycode.WORLD_20, "world 20" }, - { Keycode.WORLD_21, "world 21" }, - { Keycode.WORLD_22, "world 22" }, - { Keycode.WORLD_23, "world 23" }, - { Keycode.WORLD_24, "world 24" }, - { Keycode.WORLD_25, "world 25" }, - { Keycode.WORLD_26, "world 26" }, - { Keycode.WORLD_27, "world 27" }, - { Keycode.WORLD_28, "world 28" }, - { Keycode.WORLD_29, "world 29" }, - { Keycode.WORLD_30, "world 30" }, - { Keycode.WORLD_31, "world 31" }, - { Keycode.WORLD_32, "world 32" }, - { Keycode.WORLD_33, "world 33" }, - { Keycode.WORLD_34, "world 34" }, - { Keycode.WORLD_35, "world 35" }, - { Keycode.WORLD_36, "world 36" }, - { Keycode.WORLD_37, "world 37" }, - { Keycode.WORLD_38, "world 38" }, - { Keycode.WORLD_39, "world 39" }, - { Keycode.WORLD_40, "world 40" }, - { Keycode.WORLD_41, "world 41" }, - { Keycode.WORLD_42, "world 42" }, - { Keycode.WORLD_43, "world 43" }, - { Keycode.WORLD_44, "world 44" }, - { Keycode.WORLD_45, "world 45" }, - { Keycode.WORLD_46, "world 46" }, - { Keycode.WORLD_47, "world 47" }, - { Keycode.WORLD_48, "world 48" }, - { Keycode.WORLD_49, "world 49" }, - { Keycode.WORLD_50, "world 50" }, - { Keycode.WORLD_51, "world 51" }, - { Keycode.WORLD_52, "world 52" }, - { Keycode.WORLD_53, "world 53" }, - { Keycode.WORLD_54, "world 54" }, - { Keycode.WORLD_55, "world 55" }, - { Keycode.WORLD_56, "world 56" }, - { Keycode.WORLD_57, "world 57" }, - { Keycode.WORLD_58, "world 58" }, - { Keycode.WORLD_59, "world 59" }, - { Keycode.WORLD_60, "world 60" }, - { Keycode.WORLD_61, "world 61" }, - { Keycode.WORLD_62, "world 62" }, - { Keycode.WORLD_63, "world 63" }, - { Keycode.WORLD_64, "world 64" }, - { Keycode.WORLD_65, "world 65" }, - { Keycode.WORLD_66, "world 66" }, - { Keycode.WORLD_67, "world 67" }, - { Keycode.WORLD_68, "world 68" }, - { Keycode.WORLD_69, "world 69" }, - { Keycode.WORLD_70, "world 70" }, - { Keycode.WORLD_71, "world 71" }, - { Keycode.WORLD_72, "world 72" }, - { Keycode.WORLD_73, "world 73" }, - { Keycode.WORLD_74, "world 74" }, - { Keycode.WORLD_75, "world 75" }, - { Keycode.WORLD_76, "world 76" }, - { Keycode.WORLD_77, "world 77" }, - { Keycode.WORLD_78, "world 78" }, - { Keycode.WORLD_79, "world 79" }, - { Keycode.WORLD_80, "world 80" }, - { Keycode.WORLD_81, "world 81" }, - { Keycode.WORLD_82, "world 82" }, - { Keycode.WORLD_83, "world 83" }, - { Keycode.WORLD_84, "world 84" }, - { Keycode.WORLD_85, "world 85" }, - { Keycode.WORLD_86, "world 86" }, - { Keycode.WORLD_87, "world 87" }, - { Keycode.WORLD_88, "world 88" }, - { Keycode.WORLD_89, "world 89" }, - { Keycode.WORLD_90, "world 90" }, - { Keycode.WORLD_91, "world 91" }, - { Keycode.WORLD_92, "world 92" }, - { Keycode.WORLD_93, "world 93" }, - { Keycode.WORLD_94, "world 94" }, - { Keycode.WORLD_95, "world 95" }, - { Keycode.KP0, "[0]" }, - { Keycode.KP1, "[1]" }, - { Keycode.KP2, "[2]" }, - { Keycode.KP3, "[3]" }, - { Keycode.KP4, "[4]" }, - { Keycode.KP5, "[5]" }, - { Keycode.KP6, "[6]" }, - { Keycode.KP7, "[7]" }, - { Keycode.KP8, "[8]" }, - { Keycode.KP9, "[9]" }, - { Keycode.KP_PERIOD, "[.]" }, - { Keycode.KP_DIVIDE, "[/]" }, - { Keycode.KP_MULTIPLY, "[*]" }, - { Keycode.KP_MINUS, "[-]" }, - { Keycode.KP_PLUS, "[+]" }, - { Keycode.KP_ENTER, "enter" }, - { Keycode.KP_EQUALS, "equals" }, - { Keycode.UP, "up" }, - { Keycode.DOWN, "down" }, - { Keycode.RIGHT, "right" }, - { Keycode.LEFT, "left" }, - { Keycode.INSERT, "insert" }, - { Keycode.HOME, "home" }, - { Keycode.END, "end" }, - { Keycode.PAGEUP, "page up" }, - { Keycode.PAGEDOWN, "page down" }, - { Keycode.F1, "f1" }, - { Keycode.F2, "f2" }, - { Keycode.F3, "f3" }, - { Keycode.F4, "f4" }, - { Keycode.F5, "f5" }, - { Keycode.F6, "f6" }, - { Keycode.F7, "f7" }, - { Keycode.F8, "f8" }, - { Keycode.F9, "f9" }, - { Keycode.F10, "f10" }, - { Keycode.F11, "f11" }, - { Keycode.F12, "f12" }, - { Keycode.F13, "f13" }, - { Keycode.F14, "f14" }, - { Keycode.F15, "f15" }, - { Keycode.NUMLOCK, "numlock" }, - { Keycode.CAPSLOCK, "caps lock" }, - { Keycode.SCROLLOCK, "scroll lock" }, - { Keycode.RSHIFT, "right shift" }, - { Keycode.LSHIFT, "left shift" }, - { Keycode.RCTRL, "right ctrl" }, - { Keycode.LCTRL, "left ctrl" }, - { Keycode.RALT, "right alt" }, - { Keycode.LALT, "left alt" }, - { Keycode.RMETA, "right meta" }, - { Keycode.LMETA, "left meta" }, - { Keycode.LSUPER, "left super" }, - { Keycode.RSUPER, "right super" }, - { Keycode.MODE, "alt gr" }, - { Keycode.COMPOSE, "compose" }, - { Keycode.HELP, "help" }, - { Keycode.PRINT, "print screen" }, - { Keycode.SYSREQ, "sys req" }, - { Keycode.BREAK, "break" }, - { Keycode.MENU, "menu" }, - { Keycode.POWER, "power" }, - { Keycode.EURO, "euro" }, - { Keycode.UNDO, "undo" } + { Keycode.A, "A" }, + { Keycode.B, "B" }, + { Keycode.C, "C" }, + { Keycode.D, "D" }, + { Keycode.E, "E" }, + { Keycode.F, "F" }, + { Keycode.G, "G" }, + { Keycode.H, "H" }, + { Keycode.I, "I" }, + { Keycode.J, "J" }, + { Keycode.K, "K" }, + { Keycode.L, "L" }, + { Keycode.M, "M" }, + { Keycode.N, "N" }, + { Keycode.O, "O" }, + { Keycode.P, "P" }, + { Keycode.Q, "Q" }, + { Keycode.R, "R" }, + { Keycode.S, "S" }, + { Keycode.T, "T" }, + { Keycode.U, "U" }, + { Keycode.V, "V" }, + { Keycode.W, "W" }, + { Keycode.X, "X" }, + { Keycode.Y, "Y" }, + { Keycode.Z, "Z" }, + { Keycode.CAPSLOCK, "CapsLock" }, + { Keycode.F1, "F1" }, + { Keycode.F2, "F2" }, + { Keycode.F3, "F3" }, + { Keycode.F4, "F4" }, + { Keycode.F5, "F5" }, + { Keycode.F6, "F6" }, + { Keycode.F7, "F7" }, + { Keycode.F8, "F8" }, + { Keycode.F9, "F9" }, + { Keycode.F10, "F10" }, + { Keycode.F11, "F11" }, + { Keycode.F12, "F12" }, + { Keycode.PRINTSCREEN, "PrintScreen" }, + { Keycode.SCROLLLOCK, "ScrollLock" }, + { Keycode.PAUSE, "Pause" }, + { Keycode.INSERT, "Insert" }, + { Keycode.HOME, "Home" }, + { Keycode.PAGEUP, "PageUp" }, + { Keycode.DELETE, "Delete" }, + { Keycode.END, "End" }, + { Keycode.PAGEDOWN, "PageDown" }, + { Keycode.RIGHT, "Right" }, + { Keycode.LEFT, "Left" }, + { Keycode.DOWN, "Down" }, + { Keycode.UP, "Up" }, + { Keycode.NUMLOCKCLEAR, "Numlock" }, + { Keycode.KP_DIVIDE, "Keypad /" }, + { Keycode.KP_MULTIPLY, "Keypad *" }, + { Keycode.KP_MINUS, "Keypad -" }, + { Keycode.KP_PLUS, "Keypad +" }, + { Keycode.KP_ENTER, "Keypad Enter" }, + { Keycode.KP_1, "Keypad 1" }, + { Keycode.KP_2, "Keypad 2" }, + { Keycode.KP_3, "Keypad 3" }, + { Keycode.KP_4, "Keypad 4" }, + { Keycode.KP_5, "Keypad 5" }, + { Keycode.KP_6, "Keypad 6" }, + { Keycode.KP_7, "Keypad 7" }, + { Keycode.KP_8, "Keypad 8" }, + { Keycode.KP_9, "Keypad 9" }, + { Keycode.KP_0, "Keypad 0" }, + { Keycode.KP_PERIOD, "Keypad ." }, + { Keycode.APPLICATION, "Application" }, + { Keycode.POWER, "Power" }, + { Keycode.KP_EQUALS, "Keypad =" }, + { Keycode.F13, "F13" }, + { Keycode.F14, "F14" }, + { Keycode.F15, "F15" }, + { Keycode.F16, "F16" }, + { Keycode.F17, "F17" }, + { Keycode.F18, "F18" }, + { Keycode.F19, "F19" }, + { Keycode.F20, "F20" }, + { Keycode.F21, "F21" }, + { Keycode.F22, "F22" }, + { Keycode.F23, "F23" }, + { Keycode.F24, "F24" }, + { Keycode.EXECUTE, "Execute" }, + { Keycode.HELP, "Help" }, + { Keycode.MENU, "Menu" }, + { Keycode.SELECT, "Select" }, + { Keycode.STOP, "Stop" }, + { Keycode.AGAIN, "Again" }, + { Keycode.UNDO, "Undo" }, + { Keycode.CUT, "Cut" }, + { Keycode.COPY, "Copy" }, + { Keycode.PASTE, "Paste" }, + { Keycode.FIND, "Find" }, + { Keycode.MUTE, "Mute" }, + { Keycode.VOLUMEUP, "VolumeUp" }, + { Keycode.VOLUMEDOWN, "VolumeDown" }, + { Keycode.KP_COMMA, "Keypad }," }, + { Keycode.KP_EQUALSAS400, "Keypad, (AS400)" }, + { Keycode.ALTERASE, "AltErase" }, + { Keycode.SYSREQ, "SysReq" }, + { Keycode.CANCEL, "Cancel" }, + { Keycode.CLEAR, "Clear" }, + { Keycode.PRIOR, "Prior" }, + { Keycode.RETURN2, "Return" }, + { Keycode.SEPARATOR, "Separator" }, + { Keycode.OUT, "Out" }, + { Keycode.OPER, "Oper" }, + { Keycode.CLEARAGAIN, "Clear / Again" }, + { Keycode.CRSEL, "CrSel" }, + { Keycode.EXSEL, "ExSel" }, + { Keycode.KP_00, "Keypad 00" }, + { Keycode.KP_000, "Keypad 000" }, + { Keycode.THOUSANDSSEPARATOR, "ThousandsSeparator" }, + { Keycode.DECIMALSEPARATOR, "DecimalSeparator" }, + { Keycode.CURRENCYUNIT, "CurrencyUnit" }, + { Keycode.CURRENCYSUBUNIT, "CurrencySubUnit" }, + { Keycode.KP_LEFTPAREN, "Keypad (" }, + { Keycode.KP_RIGHTPAREN, "Keypad )" }, + { Keycode.KP_LEFTBRACE, "Keypad {" }, + { Keycode.KP_RIGHTBRACE, "Keypad }" }, + { Keycode.KP_TAB, "Keypad Tab" }, + { Keycode.KP_BACKSPACE, "Keypad Backspace" }, + { Keycode.KP_A, "Keypad A" }, + { Keycode.KP_B, "Keypad B" }, + { Keycode.KP_C, "Keypad C" }, + { Keycode.KP_D, "Keypad D" }, + { Keycode.KP_E, "Keypad E" }, + { Keycode.KP_F, "Keypad F" }, + { Keycode.KP_XOR, "Keypad XOR" }, + { Keycode.KP_POWER, "Keypad ^" }, + { Keycode.KP_PERCENT, "Keypad %" }, + { Keycode.KP_LESS, "Keypad <" }, + { Keycode.KP_GREATER, "Keypad >" }, + { Keycode.KP_AMPERSAND, "Keypad &" }, + { Keycode.KP_DBLAMPERSAND, "Keypad &&" }, + { Keycode.KP_VERTICALBAR, "Keypad |" }, + { Keycode.KP_DBLVERTICALBAR, "Keypad ||" }, + { Keycode.KP_COLON, "Keypad :" }, + { Keycode.KP_HASH, "Keypad #" }, + { Keycode.KP_SPACE, "Keypad Space" }, + { Keycode.KP_AT, "Keypad @" }, + { Keycode.KP_EXCLAM, "Keypad !" }, + { Keycode.KP_MEMSTORE, "Keypad MemStore" }, + { Keycode.KP_MEMRECALL, "Keypad MemRecall" }, + { Keycode.KP_MEMCLEAR, "Keypad MemClear" }, + { Keycode.KP_MEMADD, "Keypad MemAdd" }, + { Keycode.KP_MEMSUBTRACT, "Keypad MemSubtract" }, + { Keycode.KP_MEMMULTIPLY, "Keypad MemMultiply" }, + { Keycode.KP_MEMDIVIDE, "Keypad MemDivide" }, + { Keycode.KP_PLUSMINUS, "Keypad +/-" }, + { Keycode.KP_CLEAR, "Keypad Clear" }, + { Keycode.KP_CLEARENTRY, "Keypad ClearEntry" }, + { Keycode.KP_BINARY, "Keypad Binary" }, + { Keycode.KP_OCTAL, "Keypad Octal" }, + { Keycode.KP_DECIMAL, "Keypad Decimal" }, + { Keycode.KP_HEXADECIMAL, "Keypad Hexadecimal" }, + { Keycode.LCTRL, "Left Ctrl" }, + { Keycode.LSHIFT, "Left Shift" }, + { Keycode.LALT, "Left Alt" }, + { Keycode.LGUI, "Left GUI" }, + { Keycode.RCTRL, "Right Ctrl" }, + { Keycode.RSHIFT, "Right Shift" }, + { Keycode.RALT, "Right Alt" }, + { Keycode.RGUI, "Right GUI" }, + { Keycode.MODE, "ModeSwitch" }, + { Keycode.AUDIONEXT, "AudioNext" }, + { Keycode.AUDIOPREV, "AudioPrev" }, + { Keycode.AUDIOSTOP, "AudioStop" }, + { Keycode.AUDIOPLAY, "AudioPlay" }, + { Keycode.AUDIOMUTE, "AudioMute" }, + { Keycode.MEDIASELECT, "MediaSelect" }, + { Keycode.WWW, "WWW" }, + { Keycode.MAIL, "Mail" }, + { Keycode.CALCULATOR, "Calculator" }, + { Keycode.COMPUTER, "Computer" }, + { Keycode.AC_SEARCH, "AC Search" }, + { Keycode.AC_HOME, "AC Home" }, + { Keycode.AC_BACK, "AC Back" }, + { Keycode.AC_FORWARD, "AC Forward" }, + { Keycode.AC_STOP, "AC Stop" }, + { Keycode.AC_REFRESH, "AC Refresh" }, + { Keycode.AC_BOOKMARKS, "AC Bookmarks" }, + { Keycode.BRIGHTNESSDOWN, "BrightnessDown" }, + { Keycode.BRIGHTNESSUP, "BrightnessUp" }, + { Keycode.DISPLAYSWITCH, "DisplaySwitch" }, + { Keycode.KBDILLUMTOGGLE, "KBDIllumToggle" }, + { Keycode.KBDILLUMDOWN, "KBDIllumDown" }, + { Keycode.KBDILLUMUP, "KBDIllumUp" }, + { Keycode.EJECT, "Eject" }, + { Keycode.SLEEP, "Sleep" }, }; public static string DisplayString(Keycode k) { - var ret = "unknown"; - KeyNames.TryGetValue(k, out ret); + string ret; + if (!KeyNames.TryGetValue(k, out ret)) + return k.ToString(); + return ret; } } diff --git a/OpenRA.Game/Widgets/HotkeyEntryWidget.cs b/OpenRA.Game/Widgets/HotkeyEntryWidget.cs index 3c5ffdf51d..bbb693f226 100644 --- a/OpenRA.Game/Widgets/HotkeyEntryWidget.cs +++ b/OpenRA.Game/Widgets/HotkeyEntryWidget.cs @@ -69,7 +69,7 @@ namespace OpenRA.Widgets Keycode.RSHIFT, Keycode.LSHIFT, Keycode.RCTRL, Keycode.LCTRL, Keycode.RALT, Keycode.LALT, - Keycode.RMETA, Keycode.LMETA + Keycode.RGUI, Keycode.LGUI }; public override bool HandleKeyPress(KeyInput e)