openMSX
Keys.cc
Go to the documentation of this file.
1 #include "Keys.hh"
2 #include "StringOp.hh"
3 #include "cstd.hh"
4 #include "ranges.hh"
5 #include <array>
6 
7 using std::string;
8 using std::string_view;
9 
10 namespace openmsx::Keys {
11 
12 // can be std::pair in C++20
13 struct P {
14  constexpr P(string_view s, KeyCode k)
15  : first(s), second(k) {}
16 
17  // Needed for gcc-6.3. Compiler bug?
18  constexpr P& operator=(const P& o) {
19  first = o.first;
20  second = o.second;
21  return *this;
22  }
23  constexpr P(const P& p) = default;
24 
25  string_view first;
27 };
28 
29 struct CmpKeys {
30  // for cstd::sort
31  constexpr bool operator()(const P& x, const P& y) const {
32  return x.first < y.first; // shortcut: no need to ignore case
33  }
34 
35  // for lower_bound()
36  bool operator()(const P& x, string_view y) const {
38  return cmp(x.first, y);
39  }
40 };
41 
42 #ifdef _MSC_VER
43  // Workaround visual studio compiler bug, see
44  // https://developercommunity.visualstudio.com/content/problem/429980/wrong-code-with-constexpr-on-msvc-1916.html
45  // Disable compile-time sorting on msvc until that bug gets solved.
46  #define KEYS_CONSTEXPR
47  #define KEYS_SORT ranges::sort
48 #else
49  #define KEYS_CONSTEXPR constexpr
50  #define KEYS_SORT cstd::sort
51 #endif
52 static KEYS_CONSTEXPR auto getSortedKeys()
53 {
54  auto keys = std::array{
55  P("BACKSPACE", K_BACKSPACE),
56  P("TAB", K_TAB),
57  P("CLEAR", K_CLEAR),
58  P("RETURN", K_RETURN),
59  P("PAUSE", K_PAUSE),
60  P("ESCAPE", K_ESCAPE),
61  P("SPACE", K_SPACE),
62  P("EXCLAIM", K_EXCLAIM),
63  P("QUOTEDBL", K_QUOTEDBL),
64  P("HASH", K_HASH),
65  P("DOLLAR", K_DOLLAR),
66  P("AMPERSAND", K_AMPERSAND),
67  P("QUOTE", K_QUOTE),
68  P("LEFTPAREN", K_LEFTPAREN),
69  P("RIGHTPAREN", K_RIGHTPAREN),
70  P("ASTERISK", K_ASTERISK),
71  P("PLUS", K_PLUS),
72  P("COMMA", K_COMMA),
73  P("MINUS", K_MINUS),
74  P("PERIOD", K_PERIOD),
75  P("SLASH", K_SLASH),
76  P("0", K_0),
77  P("1", K_1),
78  P("2", K_2),
79  P("3", K_3),
80  P("4", K_4),
81  P("5", K_5),
82  P("6", K_6),
83  P("7", K_7),
84  P("8", K_8),
85  P("9", K_9),
86  P("COLON", K_COLON),
87  P("SEMICOLON", K_SEMICOLON),
88  P("LESS", K_LESS),
89  P("EQUALS", K_EQUALS),
90  P("GREATER", K_GREATER),
91  P("QUESTION", K_QUESTION),
92  P("AT", K_AT),
93 
94  P("LEFTBRACKET",K_LEFTBRACKET),
95  P("BACKSLASH", K_BACKSLASH),
96  P("RIGHTBRACKET",K_RIGHTBRACKET),
97  P("CARET", K_CARET),
98  P("UNDERSCORE", K_UNDERSCORE),
99  P("BACKQUOTE", K_BACKQUOTE),
100  P("A", K_A),
101  P("B", K_B),
102  P("C", K_C),
103  P("D", K_D),
104  P("E", K_E),
105  P("F", K_F),
106  P("G", K_G),
107  P("H", K_H),
108  P("I", K_I),
109  P("J", K_J),
110  P("K", K_K),
111  P("L", K_L),
112  P("M", K_M),
113  P("N", K_N),
114  P("O", K_O),
115  P("P", K_P),
116  P("Q", K_Q),
117  P("R", K_R),
118  P("S", K_S),
119  P("T", K_T),
120  P("U", K_U),
121  P("V", K_V),
122  P("W", K_W),
123  P("X", K_X),
124  P("Y", K_Y),
125  P("Z", K_Z),
126  P("DELETE", K_DELETE),
127 
128 /*
129  P("WORLD_0", K_WORLD_0),
130  P("WORLD_1", K_WORLD_1),
131  P("WORLD_2", K_WORLD_2),
132  P("WORLD_3", K_WORLD_3),
133  P("WORLD_4", K_WORLD_4),
134  P("WORLD_5", K_WORLD_5),
135  P("WORLD_6", K_WORLD_6),
136  P("WORLD_7", K_WORLD_7),
137  P("WORLD_8", K_WORLD_8),
138  P("WORLD_9", K_WORLD_9),
139  P("WORLD_10", K_WORLD_10),
140  P("WORLD_11", K_WORLD_11),
141  P("WORLD_12", K_WORLD_12),
142  P("WORLD_13", K_WORLD_13),
143  P("WORLD_14", K_WORLD_14),
144  P("WORLD_15", K_WORLD_15),
145  P("WORLD_16", K_WORLD_16),
146  P("WORLD_17", K_WORLD_17),
147  P("WORLD_18", K_WORLD_18),
148  P("WORLD_19", K_WORLD_19),
149  P("WORLD_20", K_WORLD_20),
150  P("WORLD_21", K_WORLD_21),
151  P("WORLD_22", K_WORLD_22),
152  P("WORLD_23", K_WORLD_23),
153  P("WORLD_24", K_WORLD_24),
154  P("WORLD_25", K_WORLD_25),
155  P("WORLD_26", K_WORLD_26),
156  P("WORLD_27", K_WORLD_27),
157  P("WORLD_28", K_WORLD_28),
158  P("WORLD_29", K_WORLD_29),
159  P("WORLD_30", K_WORLD_30),
160  P("WORLD_31", K_WORLD_31),
161  P("WORLD_32", K_WORLD_32),
162  P("WORLD_33", K_WORLD_33),
163  P("WORLD_34", K_WORLD_34),
164  P("WORLD_35", K_WORLD_35),
165  P("WORLD_36", K_WORLD_36),
166  P("WORLD_37", K_WORLD_37),
167  P("WORLD_38", K_WORLD_38),
168  P("WORLD_39", K_WORLD_39),
169  P("WORLD_40", K_WORLD_40),
170  P("WORLD_41", K_WORLD_41),
171  P("WORLD_42", K_WORLD_42),
172  P("WORLD_43", K_WORLD_43),
173  P("WORLD_44", K_WORLD_44),
174  P("WORLD_45", K_WORLD_45),
175  P("WORLD_46", K_WORLD_46),
176  P("WORLD_47", K_WORLD_47),
177  P("WORLD_48", K_WORLD_48),
178  P("WORLD_49", K_WORLD_49),
179  P("WORLD_50", K_WORLD_50),
180  P("WORLD_51", K_WORLD_51),
181  P("WORLD_52", K_WORLD_52),
182  P("WORLD_53", K_WORLD_53),
183  P("WORLD_54", K_WORLD_54),
184  P("WORLD_55", K_WORLD_55),
185  P("WORLD_56", K_WORLD_56),
186  P("WORLD_57", K_WORLD_57),
187  P("WORLD_58", K_WORLD_58),
188  P("WORLD_59", K_WORLD_59),
189  P("WORLD_60", K_WORLD_60),
190  P("WORLD_61", K_WORLD_61),
191  P("WORLD_62", K_WORLD_62),
192  P("WORLD_63", K_WORLD_63),
193  P("WORLD_64", K_WORLD_64),
194  P("WORLD_65", K_WORLD_65),
195  P("WORLD_66", K_WORLD_66),
196  P("WORLD_67", K_WORLD_67),
197  P("WORLD_68", K_WORLD_68),
198  P("WORLD_69", K_WORLD_69),
199  P("WORLD_70", K_WORLD_70),
200  P("WORLD_71", K_WORLD_71),
201  P("WORLD_72", K_WORLD_72),
202  P("WORLD_73", K_WORLD_73),
203  P("WORLD_74", K_WORLD_74),
204  P("WORLD_75", K_WORLD_75),
205  P("WORLD_76", K_WORLD_76),
206  P("WORLD_77", K_WORLD_77),
207  P("WORLD_78", K_WORLD_78),
208  P("WORLD_79", K_WORLD_79),
209  P("WORLD_80", K_WORLD_80),
210  P("WORLD_81", K_WORLD_81),
211  P("WORLD_82", K_WORLD_82),
212  P("WORLD_83", K_WORLD_83),
213  P("WORLD_84", K_WORLD_84),
214  P("WORLD_85", K_WORLD_85),
215  P("WORLD_86", K_WORLD_86),
216  P("WORLD_87", K_WORLD_87),
217  P("WORLD_88", K_WORLD_88),
218  P("WORLD_89", K_WORLD_89),
219  P("WORLD_90", K_WORLD_90),
220  P("WORLD_91", K_WORLD_91),
221  P("WORLD_92", K_WORLD_92),
222  P("WORLD_93", K_WORLD_93),
223  P("WORLD_94", K_WORLD_94),
224  P("WORLD_95", K_WORLD_95),
225 */
226 
227  // Numeric keypad
228  P("KP0", K_KP0),
229  P("KP1", K_KP1),
230  P("KP2", K_KP2),
231  P("KP3", K_KP3),
232  P("KP4", K_KP4),
233  P("KP5", K_KP5),
234  P("KP6", K_KP6),
235  P("KP7", K_KP7),
236  P("KP8", K_KP8),
237  P("KP9", K_KP9),
238  P("KP_PERIOD", K_KP_PERIOD),
239  P("KP_DIVIDE", K_KP_DIVIDE),
240  P("KP_MULTIPLY",K_KP_MULTIPLY),
241  P("KP_MINUS", K_KP_MINUS),
242  P("KP_PLUS", K_KP_PLUS),
243  P("KP_ENTER", K_KP_ENTER),
244  P("KP_EQUALS", K_KP_EQUALS),
245 
246  // Arrows + Home/End pad
247  P("UP", K_UP),
248  P("DOWN", K_DOWN),
249  P("RIGHT", K_RIGHT),
250  P("LEFT", K_LEFT),
251  P("INSERT", K_INSERT),
252  P("HOME", K_HOME),
253  P("END", K_END),
254  P("PAGEUP", K_PAGEUP),
255  P("PAGEDOWN", K_PAGEDOWN),
256 
257  // Function keys
258  P("F1", K_F1),
259  P("F2", K_F2),
260  P("F3", K_F3),
261  P("F4", K_F4),
262  P("F5", K_F5),
263  P("F6", K_F6),
264  P("F7", K_F7),
265  P("F8", K_F8),
266  P("F9", K_F9),
267  P("F10", K_F10),
268  P("F11", K_F11),
269  P("F12", K_F12),
270  P("F13", K_F13),
271  P("F14", K_F14),
272  P("F15", K_F15),
273  P("F16", K_F16),
274  P("F17", K_F17),
275  P("F18", K_F18),
276  P("F19", K_F19),
277  P("F20", K_F20),
278  P("F21", K_F21),
279  P("F22", K_F22),
280  P("F23", K_F23),
281  P("F24", K_F24),
282 
283  // Key state modifier keys
284  P("NUMLOCK", K_NUMLOCK),
285  P("CAPSLOCK", K_CAPSLOCK),
286  // Note: Older openMSX releases duplicated the SDL 1.2 spelling mistake
287  // in the scroll lock key symbol. Since the wrong spelling comes
288  // alphabetically after the right one, our to-string conversion
289  // will pick the right one.
290  P("SCROLLLOCK", K_SCROLLLOCK),
291  P("SCROLLOCK", K_SCROLLLOCK), // backwards compat
292  P("RSHIFT", K_RSHIFT),
293  P("LSHIFT", K_LSHIFT),
294  P("RCTRL", K_RCTRL),
295  P("LCTRL", K_LCTRL),
296  P("RALT", K_RALT),
297  P("LALT", K_LALT),
298 // P("RMETA", K_RMETA),
299 // P("LMETA", K_LMETA),
300  P("LSUPER", K_LSUPER), // Left "Windows" key
301  P("RSUPER", K_RSUPER), // Right "Windows" key
302  P("RMODE", K_MODE), // "Alt Gr" key
303 // P("COMPOSE", K_COMPOSE), // Multi-key compose key
304 
305  // Miscellaneous function keys
306  P("HELP", K_HELP),
307  P("PRINT", K_PRINT),
308  P("SYSREQ", K_SYSREQ),
309 // P("BREAK", K_BREAK),
310  P("MENU", K_MENU),
311  P("POWER", K_POWER), // Power Macintosh power key
312 // P("EURO", K_EURO), // Some european keyboards
313  P("UNDO", K_UNDO),
314 
315  // Application Control keys
316  P("BACK", K_BACK),
317 
318  // Japanese keyboard special keys
319  P("ZENKAKU_HENKAKU", K_ZENKAKU_HENKAKU),
320  P("MUHENKAN", K_MUHENKAN),
321  P("HENKAN_MODE", K_HENKAN_MODE),
322  P("HIRAGANA_KATAKANA", K_HIRAGANA_KATAKANA),
323 
324  // Modifiers
325  P("SHIFT", KM_SHIFT),
326  P("CTRL", KM_CTRL),
327  P("ALT", KM_ALT),
328  P("META", KM_META),
329  P("MODE", KM_MODE),
330 
331  // Direction modifiers
332  P("PRESS", KD_PRESS),
333  P("RELEASE", KD_RELEASE)
334  };
335  KEYS_SORT(keys, CmpKeys());
336  return keys;
337 }
338 
339 static KEYS_CONSTEXPR auto keys = getSortedKeys();
340 
341 KeyCode getCode(string_view name)
342 {
343  auto result = static_cast<KeyCode>(0);
344  string_view::size_type lastPos = 0;
345  while (lastPos != string_view::npos) {
346  auto pos = name.substr(lastPos).find_first_of(",+/");
347  auto part = (pos != string_view::npos)
348  ? name.substr(lastPos, pos)
349  : name.substr(lastPos);
350  auto it = ranges::lower_bound(keys, part, CmpKeys());
351  StringOp::casecmp cmp;
352  if ((it == std::end(keys)) || !cmp(it->first, part)) {
353  return K_NONE;
354  }
355  KeyCode partCode = it->second;
356  if ((partCode & K_MASK) && (result & K_MASK)) {
357  // more than one non-modifier component
358  // is not allowed
359  return K_NONE;
360  }
361  result = static_cast<KeyCode>(result | partCode);
362  lastPos = (pos != string_view::npos)
363  ? lastPos + pos + 1
364  : string_view::npos;
365  }
366  return result;
367 }
368 
369 std::pair<KeyCode, KeyCode> getCodes(SDL_Keycode sdlkeycode, Uint16 mod, SDL_Scancode sdlscancode, bool release)
370 {
371  KeyCode key;
372  switch (sdlkeycode) {
373  case SDLK_BACKSPACE: key = K_BACKSPACE; break;
374  case SDLK_TAB: key = K_TAB; break;
375  case SDLK_CLEAR: key = K_CLEAR; break;
376  case SDLK_RETURN: key = K_RETURN; break;
377  case SDLK_PAUSE: key = K_PAUSE; break;
378  case SDLK_ESCAPE: key = K_ESCAPE; break;
379  case SDLK_SPACE: key = K_SPACE; break;
380  case SDLK_EXCLAIM: key = K_EXCLAIM; break;
381  case SDLK_QUOTEDBL: key = K_QUOTEDBL; break;
382  case SDLK_HASH: key = K_HASH; break;
383  case SDLK_DOLLAR: key = K_DOLLAR; break;
384  case SDLK_AMPERSAND: key = K_AMPERSAND; break;
385  case SDLK_QUOTE: key = K_QUOTE; break;
386  case SDLK_LEFTPAREN: key = K_LEFTPAREN; break;
387  case SDLK_RIGHTPAREN: key = K_RIGHTPAREN; break;
388  case SDLK_ASTERISK: key = K_ASTERISK; break;
389  case SDLK_PLUS: key = K_PLUS; break;
390  case SDLK_COMMA: key = K_COMMA; break;
391  case SDLK_MINUS: key = K_MINUS; break;
392  case SDLK_PERIOD: key = K_PERIOD; break;
393  case SDLK_SLASH: key = K_SLASH; break;
394  case SDLK_0: key = K_0; break;
395  case SDLK_1: key = K_1; break;
396  case SDLK_2: key = K_2; break;
397  case SDLK_3: key = K_3; break;
398  case SDLK_4: key = K_4; break;
399  case SDLK_5: key = K_5; break;
400  case SDLK_6: key = K_6; break;
401  case SDLK_7: key = K_7; break;
402  case SDLK_8: key = K_8; break;
403  case SDLK_9: key = K_9; break;
404  case SDLK_COLON: key = K_COLON; break;
405  case SDLK_SEMICOLON: key = K_SEMICOLON; break;
406  case SDLK_LESS: key = K_LESS; break;
407  case SDLK_EQUALS: key = K_EQUALS; break;
408  case SDLK_GREATER: key = K_GREATER; break;
409  case SDLK_QUESTION: key = K_QUESTION; break;
410  case SDLK_AT: key = K_AT; break;
411 
412  case SDLK_LEFTBRACKET: key = K_LEFTBRACKET; break;
413  case SDLK_BACKSLASH: key = K_BACKSLASH; break;
414  case SDLK_RIGHTBRACKET: key = K_RIGHTBRACKET; break;
415  case SDLK_CARET: key = K_CARET; break;
416  case SDLK_UNDERSCORE: key = K_UNDERSCORE; break;
417  case SDLK_BACKQUOTE: key = K_BACKQUOTE; break;
418  case SDLK_a: key = K_A; break;
419  case SDLK_b: key = K_B; break;
420  case SDLK_c: key = K_C; break;
421  case SDLK_d: key = K_D; break;
422  case SDLK_e: key = K_E; break;
423  case SDLK_f: key = K_F; break;
424  case SDLK_g: key = K_G; break;
425  case SDLK_h: key = K_H; break;
426  case SDLK_i: key = K_I; break;
427  case SDLK_j: key = K_J; break;
428  case SDLK_k: key = K_K; break;
429  case SDLK_l: key = K_L; break;
430  case SDLK_m: key = K_M; break;
431  case SDLK_n: key = K_N; break;
432  case SDLK_o: key = K_O; break;
433  case SDLK_p: key = K_P; break;
434  case SDLK_q: key = K_Q; break;
435  case SDLK_r: key = K_R; break;
436  case SDLK_s: key = K_S; break;
437  case SDLK_t: key = K_T; break;
438  case SDLK_u: key = K_U; break;
439  case SDLK_v: key = K_V; break;
440  case SDLK_w: key = K_W; break;
441  case SDLK_x: key = K_X; break;
442  case SDLK_y: key = K_Y; break;
443  case SDLK_z: key = K_Z; break;
444  case SDLK_DELETE: key = K_DELETE; break;
445 
446  // Numeric keypad
447  case SDLK_KP_0: key = K_KP0; break;
448  case SDLK_KP_1: key = K_KP1; break;
449  case SDLK_KP_2: key = K_KP2; break;
450  case SDLK_KP_3: key = K_KP3; break;
451  case SDLK_KP_4: key = K_KP4; break;
452  case SDLK_KP_5: key = K_KP5; break;
453  case SDLK_KP_6: key = K_KP6; break;
454  case SDLK_KP_7: key = K_KP7; break;
455  case SDLK_KP_8: key = K_KP8; break;
456  case SDLK_KP_9: key = K_KP9; break;
457  case SDLK_KP_PERIOD: key = K_KP_PERIOD; break;
458  case SDLK_KP_DIVIDE: key = K_KP_DIVIDE; break;
459  case SDLK_KP_MULTIPLY: key = K_KP_MULTIPLY; break;
460  case SDLK_KP_MINUS: key = K_KP_MINUS; break;
461  case SDLK_KP_PLUS: key = K_KP_PLUS; break;
462  case SDLK_KP_ENTER: key = K_KP_ENTER; break;
463  case SDLK_KP_EQUALS: key = K_KP_EQUALS; break;
464 
465  // Arrows + Home/End pad
466  case SDLK_UP: key = K_UP; break;
467  case SDLK_DOWN: key = K_DOWN; break;
468  case SDLK_RIGHT: key = K_RIGHT; break;
469  case SDLK_LEFT: key = K_LEFT; break;
470  case SDLK_INSERT: key = K_INSERT; break;
471  case SDLK_HOME: key = K_HOME; break;
472  case SDLK_END: key = K_END; break;
473  case SDLK_PAGEUP: key = K_PAGEUP; break;
474  case SDLK_PAGEDOWN: key = K_PAGEDOWN; break;
475 
476  // Function keys
477  case SDLK_F1: key = K_F1; break;
478  case SDLK_F2: key = K_F2; break;
479  case SDLK_F3: key = K_F3; break;
480  case SDLK_F4: key = K_F4; break;
481  case SDLK_F5: key = K_F5; break;
482  case SDLK_F6: key = K_F6; break;
483  case SDLK_F7: key = K_F7; break;
484  case SDLK_F8: key = K_F8; break;
485  case SDLK_F9: key = K_F9; break;
486  case SDLK_F10: key = K_F10; break;
487  case SDLK_F11: key = K_F11; break;
488  case SDLK_F12: key = K_F12; break;
489  case SDLK_F13: key = K_F13; break;
490  case SDLK_F14: key = K_F14; break;
491  case SDLK_F15: key = K_F15; break;
492  case SDLK_F16: key = K_F16; break;
493  case SDLK_F17: key = K_F17; break;
494  case SDLK_F18: key = K_F18; break;
495  case SDLK_F19: key = K_F19; break;
496  case SDLK_F20: key = K_F20; break;
497  case SDLK_F21: key = K_F21; break;
498  case SDLK_F22: key = K_F22; break;
499  case SDLK_F23: key = K_F23; break;
500  case SDLK_F24: key = K_F24; break;
501 
502  // Key state modifier keys
503  case SDLK_NUMLOCKCLEAR: key = K_NUMLOCK; break;
504  case SDLK_CAPSLOCK: key = K_CAPSLOCK; break;
505  case SDLK_SCROLLLOCK: key = K_SCROLLLOCK; break;
506  case SDLK_RSHIFT: key = K_RSHIFT; break;
507  case SDLK_LSHIFT: key = K_LSHIFT; break;
508  case SDLK_RCTRL: key = K_RCTRL; break;
509  case SDLK_LCTRL: key = K_LCTRL; break;
510  case SDLK_RALT: key = K_RALT; break;
511  case SDLK_LALT: key = K_LALT; break;
512 // case SDLK_RMETA: key = K_RMETA; break;
513 // case SDLK_LMETA: key = K_LMETA; break;
514  case SDLK_LGUI: key = K_LSUPER; break; // Left "Windows" key
515  case SDLK_RGUI: key = K_RSUPER; break; // Right "Windows" key
516  case SDLK_MODE: key = K_MODE; break; // "Alt Gr" key
517 // case SDLK_COMPOSE: key = K_COMPOSE; break; // Multi-key compose key
518 
519  // Miscellaneous function keys
520  case SDLK_HELP: key = K_HELP; break;
521  case SDLK_PRINTSCREEN: key = K_PRINT; break;
522  case SDLK_SYSREQ: key = K_SYSREQ; break;
523 // case SDLK_BREAK: key = K_BREAK; break;
524  case SDLK_APPLICATION: key = K_MENU; break;
525  case SDLK_MENU: key = K_MENU; break;
526  case SDLK_POWER: key = K_POWER; break; // Power Macintosh power key
527 // case SDLK_EURO: key = K_EURO; break; // Some european keyboards
528  case SDLK_UNDO: key = K_UNDO; break;
529 
530  // Application Control keys
531  case SDLK_AC_BACK: key = K_BACK; break;
532 
533  default: key = K_UNKNOWN; break;
534  }
535 
536  KeyCode scan;
537  switch (sdlscancode) {
538  case SDL_SCANCODE_BACKSPACE: scan = K_BACKSPACE; break;
539  case SDL_SCANCODE_TAB: scan = K_TAB; break;
540  case SDL_SCANCODE_CLEAR: scan = K_CLEAR; break;
541  case SDL_SCANCODE_RETURN: scan = K_RETURN; break;
542  case SDL_SCANCODE_PAUSE: scan = K_PAUSE; break;
543  case SDL_SCANCODE_ESCAPE: scan = K_ESCAPE; break;
544  case SDL_SCANCODE_SPACE: scan = K_SPACE; break;
545  case SDL_SCANCODE_APOSTROPHE: scan = K_QUOTE; break;
546  case SDL_SCANCODE_COMMA: scan = K_COMMA; break;
547  case SDL_SCANCODE_MINUS: scan = K_MINUS; break;
548  case SDL_SCANCODE_PERIOD: scan = K_PERIOD; break;
549  case SDL_SCANCODE_SLASH: scan = K_SLASH; break;
550  case SDL_SCANCODE_0: scan = K_0; break;
551  case SDL_SCANCODE_1: scan = K_1; break;
552  case SDL_SCANCODE_2: scan = K_2; break;
553  case SDL_SCANCODE_3: scan = K_3; break;
554  case SDL_SCANCODE_4: scan = K_4; break;
555  case SDL_SCANCODE_5: scan = K_5; break;
556  case SDL_SCANCODE_6: scan = K_6; break;
557  case SDL_SCANCODE_7: scan = K_7; break;
558  case SDL_SCANCODE_8: scan = K_8; break;
559  case SDL_SCANCODE_9: scan = K_9; break;
560  case SDL_SCANCODE_SEMICOLON: scan = K_SEMICOLON; break;
561  case SDL_SCANCODE_EQUALS: scan = K_EQUALS; break;
562 
563  case SDL_SCANCODE_LEFTBRACKET: scan = K_LEFTBRACKET; break;
564  case SDL_SCANCODE_BACKSLASH: scan = K_BACKSLASH; break;
565  case SDL_SCANCODE_RIGHTBRACKET: scan = K_RIGHTBRACKET; break;
566  case SDL_SCANCODE_GRAVE: scan = K_BACKQUOTE; break;
567  case SDL_SCANCODE_A: scan = K_A; break;
568  case SDL_SCANCODE_B: scan = K_B; break;
569  case SDL_SCANCODE_C: scan = K_C; break;
570  case SDL_SCANCODE_D: scan = K_D; break;
571  case SDL_SCANCODE_E: scan = K_E; break;
572  case SDL_SCANCODE_F: scan = K_F; break;
573  case SDL_SCANCODE_G: scan = K_G; break;
574  case SDL_SCANCODE_H: scan = K_H; break;
575  case SDL_SCANCODE_I: scan = K_I; break;
576  case SDL_SCANCODE_J: scan = K_J; break;
577  case SDL_SCANCODE_K: scan = K_K; break;
578  case SDL_SCANCODE_L: scan = K_L; break;
579  case SDL_SCANCODE_M: scan = K_M; break;
580  case SDL_SCANCODE_N: scan = K_N; break;
581  case SDL_SCANCODE_O: scan = K_O; break;
582  case SDL_SCANCODE_P: scan = K_P; break;
583  case SDL_SCANCODE_Q: scan = K_Q; break;
584  case SDL_SCANCODE_R: scan = K_R; break;
585  case SDL_SCANCODE_S: scan = K_S; break;
586  case SDL_SCANCODE_T: scan = K_T; break;
587  case SDL_SCANCODE_U: scan = K_U; break;
588  case SDL_SCANCODE_V: scan = K_V; break;
589  case SDL_SCANCODE_W: scan = K_W; break;
590  case SDL_SCANCODE_X: scan = K_X; break;
591  case SDL_SCANCODE_Y: scan = K_Y; break;
592  case SDL_SCANCODE_Z: scan = K_Z; break;
593  case SDL_SCANCODE_DELETE: scan = K_DELETE; break;
594 
595  // Numeric keypad
596  case SDL_SCANCODE_KP_0: scan = K_KP0; break;
597  case SDL_SCANCODE_KP_1: scan = K_KP1; break;
598  case SDL_SCANCODE_KP_2: scan = K_KP2; break;
599  case SDL_SCANCODE_KP_3: scan = K_KP3; break;
600  case SDL_SCANCODE_KP_4: scan = K_KP4; break;
601  case SDL_SCANCODE_KP_5: scan = K_KP5; break;
602  case SDL_SCANCODE_KP_6: scan = K_KP6; break;
603  case SDL_SCANCODE_KP_7: scan = K_KP7; break;
604  case SDL_SCANCODE_KP_8: scan = K_KP8; break;
605  case SDL_SCANCODE_KP_9: scan = K_KP9; break;
606  case SDL_SCANCODE_KP_PERIOD: scan = K_KP_PERIOD; break;
607  case SDL_SCANCODE_KP_DIVIDE: scan = K_KP_DIVIDE; break;
608  case SDL_SCANCODE_KP_MULTIPLY: scan = K_KP_MULTIPLY; break;
609  case SDL_SCANCODE_KP_MINUS: scan = K_KP_MINUS; break;
610  case SDL_SCANCODE_KP_PLUS: scan = K_KP_PLUS; break;
611  case SDL_SCANCODE_KP_ENTER: scan = K_KP_ENTER; break;
612  case SDL_SCANCODE_KP_EQUALS: scan = K_KP_EQUALS; break;
613 
614  // Arrows + Home/End pad
615  case SDL_SCANCODE_UP: scan = K_UP; break;
616  case SDL_SCANCODE_DOWN: scan = K_DOWN; break;
617  case SDL_SCANCODE_RIGHT: scan = K_RIGHT; break;
618  case SDL_SCANCODE_LEFT: scan = K_LEFT; break;
619  case SDL_SCANCODE_INSERT: scan = K_INSERT; break;
620  case SDL_SCANCODE_HOME: scan = K_HOME; break;
621  case SDL_SCANCODE_END: scan = K_END; break;
622  case SDL_SCANCODE_PAGEUP: scan = K_PAGEUP; break;
623  case SDL_SCANCODE_PAGEDOWN: scan = K_PAGEDOWN; break;
624 
625  // Function keys
626  case SDL_SCANCODE_F1: scan = K_F1; break;
627  case SDL_SCANCODE_F2: scan = K_F2; break;
628  case SDL_SCANCODE_F3: scan = K_F3; break;
629  case SDL_SCANCODE_F4: scan = K_F4; break;
630  case SDL_SCANCODE_F5: scan = K_F5; break;
631  case SDL_SCANCODE_F6: scan = K_F6; break;
632  case SDL_SCANCODE_F7: scan = K_F7; break;
633  case SDL_SCANCODE_F8: scan = K_F8; break;
634  case SDL_SCANCODE_F9: scan = K_F9; break;
635  case SDL_SCANCODE_F10: scan = K_F10; break;
636  case SDL_SCANCODE_F11: scan = K_F11; break;
637  case SDL_SCANCODE_F12: scan = K_F12; break;
638  case SDL_SCANCODE_F13: scan = K_F13; break;
639  case SDL_SCANCODE_F14: scan = K_F14; break;
640  case SDL_SCANCODE_F15: scan = K_F15; break;
641  case SDL_SCANCODE_F16: scan = K_F16; break;
642  case SDL_SCANCODE_F17: scan = K_F17; break;
643  case SDL_SCANCODE_F18: scan = K_F18; break;
644  case SDL_SCANCODE_F19: scan = K_F19; break;
645  case SDL_SCANCODE_F20: scan = K_F20; break;
646  case SDL_SCANCODE_F21: scan = K_F21; break;
647  case SDL_SCANCODE_F22: scan = K_F22; break;
648  case SDL_SCANCODE_F23: scan = K_F23; break;
649  case SDL_SCANCODE_F24: scan = K_F24; break;
650 
651  // Key state modifier keys
652  case SDL_SCANCODE_NUMLOCKCLEAR: scan = K_NUMLOCK; break;
653  case SDL_SCANCODE_CAPSLOCK: scan = K_CAPSLOCK; break;
654  case SDL_SCANCODE_SCROLLLOCK: scan = K_SCROLLLOCK; break;
655  case SDL_SCANCODE_RSHIFT: scan = K_RSHIFT; break;
656  case SDL_SCANCODE_LSHIFT: scan = K_LSHIFT; break;
657  case SDL_SCANCODE_RCTRL: scan = K_RCTRL; break;
658  case SDL_SCANCODE_LCTRL: scan = K_LCTRL; break;
659  case SDL_SCANCODE_RALT: scan = K_RALT; break;
660  case SDL_SCANCODE_LALT: scan = K_LALT; break;
661  case SDL_SCANCODE_LGUI: scan = K_LSUPER; break; // Left "Windows" key
662  case SDL_SCANCODE_RGUI: scan = K_RSUPER; break; // Right "Windows" key
663  case SDL_SCANCODE_MODE: scan = K_MODE; break; // "Alt Gr" key
664 
665  // Miscellaneous function keys
666  case SDL_SCANCODE_HELP: scan = K_HELP; break;
667  case SDL_SCANCODE_PRINTSCREEN: scan = K_PRINT; break;
668  case SDL_SCANCODE_SYSREQ: scan = K_SYSREQ; break;
669  case SDL_SCANCODE_APPLICATION: scan = K_MENU; break;
670  case SDL_SCANCODE_MENU: scan = K_MENU; break;
671  case SDL_SCANCODE_POWER: scan = K_POWER; break; // Power Macintosh power key
672  case SDL_SCANCODE_UNDO: scan = K_UNDO; break;
673 
674  // Application Control keys
675  case SDL_SCANCODE_AC_BACK: scan = K_BACK; break;
676 
677  default: scan = K_UNKNOWN; break;
678  }
679 
680  // Handle keys that don't have a key code but do have a scan code.
681  if (key == K_UNKNOWN) {
682  // Assume it is a Japanese keyboard and check
683  // scancode to recognize a few japanese
684  // specific keys for which SDL does not have an
685  // SDL_Keycode keysym definition.
686  switch (sdlscancode) {
687  // Keys found on Japanese keyboards:
688  case 49:
689  key = K_ZENKAKU_HENKAKU;
690  break;
691  case 129:
692  key = K_HENKAN_MODE;
693  break;
694  //case 131:
695  // key = K_MUHENKAN;
696  // break;
697  case 208:
698  key = K_HIRAGANA_KATAKANA;
699  break;
700  // Keys found on Korean keyboards:
701  case 56:
702  // On Korean keyboard this code is used for R-ALT key but SDL does
703  // not seem to recognize it, as reported by Miso Kim.
704  key = K_RALT;
705  break;
706  default:
707  break; // nothing, silence compiler warning
708  }
709  }
710 
711  // Apply modifiers.
712  if (mod & KMOD_CTRL) {
713  key = combine(key, KM_CTRL);
714  scan = combine(scan, KM_CTRL);
715  }
716  if (mod & KMOD_SHIFT) {
717  key = combine(key, KM_SHIFT);
718  scan = combine(scan, KM_SHIFT);
719  }
720  if (mod & KMOD_ALT) {
721  key = combine(key, KM_ALT);
722  scan = combine(scan, KM_ALT);
723  }
724  if (mod & KMOD_GUI) {
725  key = combine(key, KM_META);
726  scan = combine(scan, KM_META);
727  }
728  if (mod & KMOD_MODE) {
729  key = combine(key, KM_MODE);
730  scan = combine(scan, KM_MODE);
731  }
732 
733  if (release) {
734  key = combine(key, KD_RELEASE);
735  scan = combine(scan, KD_RELEASE);
736  }
737  return {key, scan};
738 }
739 
740 string getName(KeyCode keyCode)
741 {
742  string result;
743  for (const auto& [name, code] : keys) {
744  if (code == (keyCode & K_MASK)) {
745  result = name;
746  break;
747  }
748  }
749  if (result.empty()) {
750  return "unknown";
751  }
752  if (keyCode & KM_CTRL) {
753  result += "+CTRL";
754  }
755  if (keyCode & KM_SHIFT) {
756  result += "+SHIFT";
757  }
758  if (keyCode & KM_ALT) {
759  result += "+ALT";
760  }
761  if (keyCode & KM_META) {
762  result += "+META";
763  }
764  if (keyCode & KM_MODE) {
765  result += "+MODE";
766  }
767  if (keyCode & KD_RELEASE) {
768  result += ",RELEASE";
769  }
770  return result;
771 }
772 
773 } // namespace openmsx::Keys
openmsx::Keys::K_PAUSE
@ K_PAUSE
Definition: Keys.hh:35
openmsx::Keys::K_COLON
@ K_COLON
Definition: Keys.hh:62
openmsx::Keys::K_CLEAR
@ K_CLEAR
Definition: Keys.hh:33
openmsx::Keys::K_RSHIFT
@ K_RSHIFT
Definition: Keys.hh:164
openmsx::Keys::K_F5
@ K_F5
Definition: Keys.hh:139
openmsx::Keys::K_QUESTION
@ K_QUESTION
Definition: Keys.hh:67
openmsx::Keys::K_N
@ K_N
Definition: Keys.hh:89
openmsx::Keys::P::second
KeyCode second
Definition: Keys.cc:26
openmsx::Keys::K_INSERT
@ K_INSERT
Definition: Keys.hh:128
openmsx::Keys::K_ESCAPE
@ K_ESCAPE
Definition: Keys.hh:36
openmsx::Keys::KM_META
@ KM_META
Definition: Keys.hh:207
openmsx::Keys::K_F9
@ K_F9
Definition: Keys.hh:143
openmsx::Keys::K_R
@ K_R
Definition: Keys.hh:93
openmsx::Keys::getCodes
std::pair< KeyCode, KeyCode > getCodes(SDL_Keycode sdlkeycode, Uint16 mod, SDL_Scancode sdlscancode, bool release)
Translate SDL_Keycode/SDL_Scancode into openMSX key/scan Keycode's.
Definition: Keys.cc:369
openmsx::Keys::K_O
@ K_O
Definition: Keys.hh:90
openmsx::Keys::K_SCROLLLOCK
@ K_SCROLLLOCK
Definition: Keys.hh:163
openmsx::Keys::K_SYSREQ
@ K_SYSREQ
Definition: Keys.hh:180
openmsx::Keys::K_EXCLAIM
@ K_EXCLAIM
Definition: Keys.hh:38
openmsx::Keys::K_F22
@ K_F22
Definition: Keys.hh:156
openmsx::Keys::K_F6
@ K_F6
Definition: Keys.hh:140
openmsx::Keys::K_A
@ K_A
Definition: Keys.hh:76
openmsx::Keys::K_KP_MINUS
@ K_KP_MINUS
Definition: Keys.hh:118
openmsx::Keys::K_W
@ K_W
Definition: Keys.hh:98
openmsx::Keys::K_KP1
@ K_KP1
Definition: Keys.hh:106
StringOp::caseless
Definition: StringOp.hh:61
openmsx::Keys::K_Y
@ K_Y
Definition: Keys.hh:100
cstd.hh
openmsx::Keys::K_HIRAGANA_KATAKANA
@ K_HIRAGANA_KATAKANA
Definition: Keys.hh:201
openmsx::Keys::K_Q
@ K_Q
Definition: Keys.hh:92
openmsx::Keys::K_LSHIFT
@ K_LSHIFT
Definition: Keys.hh:165
openmsx::Keys::K_NUMLOCK
@ K_NUMLOCK
Definition: Keys.hh:161
openmsx::Keys::P::first
string_view first
Definition: Keys.cc:25
openmsx::Keys::K_RIGHTPAREN
@ K_RIGHTPAREN
Definition: Keys.hh:45
ranges::lower_bound
auto lower_bound(ForwardRange &&range, const T &value)
Definition: ranges.hh:71
openmsx::Keys::K_Z
@ K_Z
Definition: Keys.hh:101
openmsx::Keys::K_6
@ K_6
Definition: Keys.hh:58
openmsx::Keys::K_G
@ K_G
Definition: Keys.hh:82
openmsx::Keys::K_C
@ K_C
Definition: Keys.hh:78
StringOp::casecmp
Definition: StringOp.hh:68
ranges.hh
openmsx::Keys::K_KP_PERIOD
@ K_KP_PERIOD
Definition: Keys.hh:115
openmsx::Keys::K_KP0
@ K_KP0
Definition: Keys.hh:105
openmsx::Keys::K_RIGHT
@ K_RIGHT
Definition: Keys.hh:126
openmsx::Keys::K_5
@ K_5
Definition: Keys.hh:57
openmsx::Keys::K_UNDO
@ K_UNDO
Definition: Keys.hh:185
openmsx::Keys::K_CARET
@ K_CARET
Definition: Keys.hh:73
openmsx::Keys::CmpKeys
Definition: Keys.cc:29
openmsx::Keys::K_COMMA
@ K_COMMA
Definition: Keys.hh:48
openmsx::Keys::K_2
@ K_2
Definition: Keys.hh:54
openmsx::Keys::K_F2
@ K_F2
Definition: Keys.hh:136
openmsx::Keys::K_9
@ K_9
Definition: Keys.hh:61
openmsx::Keys::K_EQUALS
@ K_EQUALS
Definition: Keys.hh:65
openmsx::Keys::K_F3
@ K_F3
Definition: Keys.hh:137
openmsx::Keys::K_F23
@ K_F23
Definition: Keys.hh:157
openmsx::Keys::combine
KeyCode combine(KeyCode key, KeyCode modifier)
Convenience method to create key combinations (hides ugly casts).
Definition: Keys.hh:234
openmsx::Keys::K_SPACE
@ K_SPACE
Definition: Keys.hh:37
openmsx::Keys::K_DOLLAR
@ K_DOLLAR
Definition: Keys.hh:41
openmsx::Keys::K_F15
@ K_F15
Definition: Keys.hh:149
openmsx::Keys::K_F19
@ K_F19
Definition: Keys.hh:153
openmsx::Keys::K_J
@ K_J
Definition: Keys.hh:85
openmsx::Keys::K_RALT
@ K_RALT
Definition: Keys.hh:168
openmsx::Keys::K_RCTRL
@ K_RCTRL
Definition: Keys.hh:166
openmsx::Keys::K_F11
@ K_F11
Definition: Keys.hh:145
openmsx::Keys::K_F1
@ K_F1
Definition: Keys.hh:135
openmsx::Keys::getCode
KeyCode getCode(string_view name)
Translate key name to key code.
Definition: Keys.cc:341
openmsx::Keys::K_KP_MULTIPLY
@ K_KP_MULTIPLY
Definition: Keys.hh:117
openmsx::Keys::K_P
@ K_P
Definition: Keys.hh:91
openmsx::Keys
Definition: Keys.cc:10
openmsx::Keys::K_F12
@ K_F12
Definition: Keys.hh:146
openmsx::Keys::K_NONE
@ K_NONE
Definition: Keys.hh:29
openmsx::Keys::K_SEMICOLON
@ K_SEMICOLON
Definition: Keys.hh:63
openmsx::Keys::K_KP6
@ K_KP6
Definition: Keys.hh:111
openmsx::Keys::CmpKeys::operator()
bool operator()(const P &x, string_view y) const
Definition: Keys.cc:36
openmsx::Keys::K_H
@ K_H
Definition: Keys.hh:83
openmsx::Keys::K_DOWN
@ K_DOWN
Definition: Keys.hh:125
openmsx::Keys::K_BACKQUOTE
@ K_BACKQUOTE
Definition: Keys.hh:75
openmsx::Keys::K_KP3
@ K_KP3
Definition: Keys.hh:108
openmsx::Keys::K_F20
@ K_F20
Definition: Keys.hh:154
openmsx::Keys::K_8
@ K_8
Definition: Keys.hh:60
openmsx::Keys::getName
string getName(KeyCode keyCode)
Translate key code to key name.
Definition: Keys.cc:740
openmsx::Keys::K_F17
@ K_F17
Definition: Keys.hh:151
openmsx::Keys::K_RIGHTBRACKET
@ K_RIGHTBRACKET
Definition: Keys.hh:72
openmsx::Keys::KM_ALT
@ KM_ALT
Definition: Keys.hh:206
openmsx::Keys::K_3
@ K_3
Definition: Keys.hh:55
openmsx::Keys::K_4
@ K_4
Definition: Keys.hh:56
openmsx::Keys::K_PRINT
@ K_PRINT
Definition: Keys.hh:179
openmsx::Keys::K_BACK
@ K_BACK
Definition: Keys.hh:188
openmsx::Keys::K_D
@ K_D
Definition: Keys.hh:79
openmsx::Keys::K_AMPERSAND
@ K_AMPERSAND
Definition: Keys.hh:42
openmsx::Keys::K_PERIOD
@ K_PERIOD
Definition: Keys.hh:50
openmsx::Keys::K_I
@ K_I
Definition: Keys.hh:84
openmsx::Keys::KM_CTRL
@ KM_CTRL
Definition: Keys.hh:205
openmsx::Keys::K_F10
@ K_F10
Definition: Keys.hh:144
openmsx::Keys::K_X
@ K_X
Definition: Keys.hh:99
openmsx::Keys::P::P
constexpr P(string_view s, KeyCode k)
Definition: Keys.cc:14
openmsx::Keys::KD_PRESS
@ KD_PRESS
Definition: Keys.hh:211
openmsx::Keys::K_RSUPER
@ K_RSUPER
Definition: Keys.hh:173
openmsx::Keys::K_UNKNOWN
@ K_UNKNOWN
Definition: Keys.hh:30
openmsx::Keys::K_DELETE
@ K_DELETE
Definition: Keys.hh:102
openmsx::Keys::K_KP2
@ K_KP2
Definition: Keys.hh:107
openmsx::Keys::K_7
@ K_7
Definition: Keys.hh:59
Keys.hh
openmsx::Keys::K_AT
@ K_AT
Definition: Keys.hh:68
openmsx::Keys::K_KP_EQUALS
@ K_KP_EQUALS
Definition: Keys.hh:121
openmsx::Keys::K_BACKSPACE
@ K_BACKSPACE
Definition: Keys.hh:31
openmsx::Keys::K_U
@ K_U
Definition: Keys.hh:96
openmsx::Keys::K_CAPSLOCK
@ K_CAPSLOCK
Definition: Keys.hh:162
KEYS_CONSTEXPR
#define KEYS_CONSTEXPR
Definition: Keys.cc:49
openmsx::Keys::K_F8
@ K_F8
Definition: Keys.hh:142
openmsx::x
constexpr KeyMatrixPosition x
Keyboard bindings.
Definition: Keyboard.cc:1419
openmsx::Keys::K_ASTERISK
@ K_ASTERISK
Definition: Keys.hh:46
openmsx::Keys::K_KP_ENTER
@ K_KP_ENTER
Definition: Keys.hh:120
openmsx::Keys::K_K
@ K_K
Definition: Keys.hh:86
openmsx::Keys::KM_SHIFT
@ KM_SHIFT
Definition: Keys.hh:204
openmsx::Keys::K_F24
@ K_F24
Definition: Keys.hh:158
openmsx::Keys::K_HASH
@ K_HASH
Definition: Keys.hh:40
openmsx::Keys::K_0
@ K_0
Definition: Keys.hh:52
openmsx::Keys::K_M
@ K_M
Definition: Keys.hh:88
openmsx::Keys::K_V
@ K_V
Definition: Keys.hh:97
openmsx::Keys::K_UP
@ K_UP
Definition: Keys.hh:124
StringOp.hh
openmsx::Keys::K_F13
@ K_F13
Definition: Keys.hh:147
openmsx::Keys::K_L
@ K_L
Definition: Keys.hh:87
openmsx::Keys::K_B
@ K_B
Definition: Keys.hh:77
openmsx::Keys::K_LEFT
@ K_LEFT
Definition: Keys.hh:127
openmsx::Keys::K_KP7
@ K_KP7
Definition: Keys.hh:112
openmsx::Keys::K_ZENKAKU_HENKAKU
@ K_ZENKAKU_HENKAKU
Definition: Keys.hh:198
openmsx::Keys::K_HELP
@ K_HELP
Definition: Keys.hh:178
openmsx::Keys::P
Definition: Keys.cc:13
openmsx::Keys::K_QUOTE
@ K_QUOTE
Definition: Keys.hh:43
openmsx::Keys::K_F
@ K_F
Definition: Keys.hh:81
openmsx::Keys::K_RETURN
@ K_RETURN
Definition: Keys.hh:34
openmsx::Keys::K_F16
@ K_F16
Definition: Keys.hh:150
openmsx::Keys::K_KP5
@ K_KP5
Definition: Keys.hh:110
openmsx::Keys::K_GREATER
@ K_GREATER
Definition: Keys.hh:66
openmsx::Keys::K_KP4
@ K_KP4
Definition: Keys.hh:109
openmsx::Keys::K_SLASH
@ K_SLASH
Definition: Keys.hh:51
openmsx::Keys::K_F7
@ K_F7
Definition: Keys.hh:141
openmsx::Keys::K_QUOTEDBL
@ K_QUOTEDBL
Definition: Keys.hh:39
openmsx::Keys::K_F4
@ K_F4
Definition: Keys.hh:138
openmsx::Keys::K_PLUS
@ K_PLUS
Definition: Keys.hh:47
openmsx::Keys::K_POWER
@ K_POWER
Definition: Keys.hh:183
openmsx::Keys::K_KP_PLUS
@ K_KP_PLUS
Definition: Keys.hh:119
openmsx::Keys::K_HENKAN_MODE
@ K_HENKAN_MODE
Definition: Keys.hh:200
openmsx::Keys::K_F14
@ K_F14
Definition: Keys.hh:148
openmsx::Keys::K_MINUS
@ K_MINUS
Definition: Keys.hh:49
openmsx::Keys::KeyCode
KeyCode
Constants that identify keys and key modifiers.
Definition: Keys.hh:26
openmsx::Keys::K_S
@ K_S
Definition: Keys.hh:94
openmsx::Keys::K_LCTRL
@ K_LCTRL
Definition: Keys.hh:167
KEYS_SORT
#define KEYS_SORT
Definition: Keys.cc:50
openmsx::Keys::K_PAGEDOWN
@ K_PAGEDOWN
Definition: Keys.hh:132
openmsx::Keys::KM_MODE
@ KM_MODE
Definition: Keys.hh:208
openmsx::Keys::K_LSUPER
@ K_LSUPER
Definition: Keys.hh:172
openmsx::Keys::K_MUHENKAN
@ K_MUHENKAN
Definition: Keys.hh:199
openmsx::Keys::K_TAB
@ K_TAB
Definition: Keys.hh:32
openmsx::Keys::K_F18
@ K_F18
Definition: Keys.hh:152
openmsx::Keys::K_T
@ K_T
Definition: Keys.hh:95
openmsx::Keys::K_KP8
@ K_KP8
Definition: Keys.hh:113
openmsx::Keys::K_LALT
@ K_LALT
Definition: Keys.hh:169
openmsx::Keys::K_MODE
@ K_MODE
Definition: Keys.hh:174
openmsx::Keys::KD_RELEASE
@ KD_RELEASE
Definition: Keys.hh:212
openmsx::Keys::K_MASK
@ K_MASK
Definition: Keys.hh:27
openmsx::Keys::K_PAGEUP
@ K_PAGEUP
Definition: Keys.hh:131
openmsx::Keys::K_KP_DIVIDE
@ K_KP_DIVIDE
Definition: Keys.hh:116
openmsx::Keys::K_1
@ K_1
Definition: Keys.hh:53
openmsx::Keys::P::P
constexpr P(const P &p)=default
openmsx::Keys::CmpKeys::operator()
constexpr bool operator()(const P &x, const P &y) const
Definition: Keys.cc:31
openmsx::Keys::K_HOME
@ K_HOME
Definition: Keys.hh:129
openmsx::Keys::K_F21
@ K_F21
Definition: Keys.hh:155
openmsx::Keys::K_LESS
@ K_LESS
Definition: Keys.hh:64
openmsx::Keys::K_MENU
@ K_MENU
Definition: Keys.hh:182
openmsx::Keys::P::operator=
constexpr P & operator=(const P &o)
Definition: Keys.cc:18
openmsx::Keys::K_KP9
@ K_KP9
Definition: Keys.hh:114
openmsx::Keys::K_END
@ K_END
Definition: Keys.hh:130
openmsx::Keys::K_LEFTBRACKET
@ K_LEFTBRACKET
Definition: Keys.hh:70
openmsx::Keys::K_LEFTPAREN
@ K_LEFTPAREN
Definition: Keys.hh:44
openmsx::Keys::K_BACKSLASH
@ K_BACKSLASH
Definition: Keys.hh:71
openmsx::Keys::K_UNDERSCORE
@ K_UNDERSCORE
Definition: Keys.hh:74
openmsx::Keys::K_E
@ K_E
Definition: Keys.hh:80