OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_EVENTS_KEYCODES_DOM_US_LAYOUT_DATA_H_ | 5 #ifndef UI_EVENTS_KEYCODES_DOM_US_LAYOUT_DATA_H_ |
6 #define UI_EVENTS_KEYCODES_DOM_US_LAYOUT_DATA_H_ | 6 #define UI_EVENTS_KEYCODES_DOM_US_LAYOUT_DATA_H_ |
7 | 7 |
8 namespace ui { | 8 namespace ui { |
9 | 9 |
10 // This table maps a DomCode to a printable character, assuming US layout. | 10 // This table maps a DomCode to a printable character, assuming US layout. |
| 11 // It is used by DomCodeToUsLayoutMeaning(), which provides a fallback |
| 12 // interpretation when there is no other way to map a physical key. |
11 const struct PrintableCodeEntry { | 13 const struct PrintableCodeEntry { |
12 DomCode dom_code; | 14 DomCode dom_code; |
13 base::char16 character[2]; // normal, shift | 15 base::char16 character[2]; // normal, shift |
14 } kPrintableCodeMap[] = { | 16 } kPrintableCodeMap[] = { |
15 {DomCode::KEY_A, {'a', 'A'}}, | 17 {DomCode::KEY_A, {'a', 'A'}}, |
16 {DomCode::KEY_B, {'b', 'B'}}, | 18 {DomCode::KEY_B, {'b', 'B'}}, |
17 {DomCode::KEY_C, {'c', 'C'}}, | 19 {DomCode::KEY_C, {'c', 'C'}}, |
18 {DomCode::KEY_D, {'d', 'D'}}, | 20 {DomCode::KEY_D, {'d', 'D'}}, |
19 {DomCode::KEY_E, {'e', 'E'}}, | 21 {DomCode::KEY_E, {'e', 'E'}}, |
20 {DomCode::KEY_F, {'f', 'F'}}, | 22 {DomCode::KEY_F, {'f', 'F'}}, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 {DomCode::EQUAL, {'=', '+'}}, | 55 {DomCode::EQUAL, {'=', '+'}}, |
54 {DomCode::BRACKET_LEFT, {'[', '{'}}, | 56 {DomCode::BRACKET_LEFT, {'[', '{'}}, |
55 {DomCode::BRACKET_RIGHT, {']', '}'}}, | 57 {DomCode::BRACKET_RIGHT, {']', '}'}}, |
56 {DomCode::BACKSLASH, {'\\', '|'}}, | 58 {DomCode::BACKSLASH, {'\\', '|'}}, |
57 {DomCode::SEMICOLON, {';', ':'}}, | 59 {DomCode::SEMICOLON, {';', ':'}}, |
58 {DomCode::QUOTE, {'\'', '"'}}, | 60 {DomCode::QUOTE, {'\'', '"'}}, |
59 {DomCode::BACKQUOTE, {'`', '~'}}, | 61 {DomCode::BACKQUOTE, {'`', '~'}}, |
60 {DomCode::COMMA, {',', '<'}}, | 62 {DomCode::COMMA, {',', '<'}}, |
61 {DomCode::PERIOD, {'.', '>'}}, | 63 {DomCode::PERIOD, {'.', '>'}}, |
62 {DomCode::SLASH, {'/', '?'}}, | 64 {DomCode::SLASH, {'/', '?'}}, |
63 {DomCode::INTL_BACKSLASH, {'\\', '|'}}, | 65 {DomCode::INTL_BACKSLASH, {'<', '>'}}, |
| 66 {DomCode::INTL_HASH, {'\\', '|'}}, |
64 {DomCode::INTL_YEN, {0x00A5, '|'}}, | 67 {DomCode::INTL_YEN, {0x00A5, '|'}}, |
65 {DomCode::NUMPAD_DIVIDE, {'/', '/'}}, | 68 {DomCode::NUMPAD_DIVIDE, {'/', '/'}}, |
66 {DomCode::NUMPAD_MULTIPLY, {'*', '*'}}, | 69 {DomCode::NUMPAD_MULTIPLY, {'*', '*'}}, |
67 {DomCode::NUMPAD_SUBTRACT, {'-', '-'}}, | 70 {DomCode::NUMPAD_SUBTRACT, {'-', '-'}}, |
68 {DomCode::NUMPAD_ADD, {'+', '+'}}, | 71 {DomCode::NUMPAD_ADD, {'+', '+'}}, |
69 {DomCode::NUMPAD1, {'1', '1'}}, | 72 {DomCode::NUMPAD1, {'1', '1'}}, |
70 {DomCode::NUMPAD2, {'2', '2'}}, | 73 {DomCode::NUMPAD2, {'2', '2'}}, |
71 {DomCode::NUMPAD3, {'3', '3'}}, | 74 {DomCode::NUMPAD3, {'3', '3'}}, |
72 {DomCode::NUMPAD4, {'4', '4'}}, | 75 {DomCode::NUMPAD4, {'4', '4'}}, |
73 {DomCode::NUMPAD5, {'5', '5'}}, | 76 {DomCode::NUMPAD5, {'5', '5'}}, |
74 {DomCode::NUMPAD6, {'6', '6'}}, | 77 {DomCode::NUMPAD6, {'6', '6'}}, |
75 {DomCode::NUMPAD7, {'7', '7'}}, | 78 {DomCode::NUMPAD7, {'7', '7'}}, |
76 {DomCode::NUMPAD8, {'8', '8'}}, | 79 {DomCode::NUMPAD8, {'8', '8'}}, |
77 {DomCode::NUMPAD9, {'9', '9'}}, | 80 {DomCode::NUMPAD9, {'9', '9'}}, |
78 {DomCode::NUMPAD0, {'0', '0'}}, | 81 {DomCode::NUMPAD0, {'0', '0'}}, |
79 {DomCode::NUMPAD_DECIMAL, {'.', '.'}}, | 82 {DomCode::NUMPAD_DECIMAL, {'.', '.'}}, |
80 {DomCode::NUMPAD_EQUAL, {'=', '='}}, | 83 {DomCode::NUMPAD_EQUAL, {'=', '='}}, |
81 {DomCode::NUMPAD_COMMA, {',', ','}}, | 84 {DomCode::NUMPAD_COMMA, {',', ','}}, |
82 {DomCode::NUMPAD_PAREN_LEFT, {'(', '('}}, | 85 {DomCode::NUMPAD_PAREN_LEFT, {'(', '('}}, |
83 {DomCode::NUMPAD_PAREN_RIGHT, {')', ')'}}, | 86 {DomCode::NUMPAD_PAREN_RIGHT, {')', ')'}}, |
84 {DomCode::NUMPAD_SIGN_CHANGE, {0x00B1, 0x00B1}}, | 87 {DomCode::NUMPAD_SIGN_CHANGE, {0x00B1, 0x00B1}}, |
85 }; | 88 }; |
86 | 89 |
87 // This table maps a DomCode to a DomKey, assuming US keyboard layout. | 90 // This table maps a DomCode to a DomKey, assuming US keyboard layout. |
| 91 // It is used by DomCodeToUsLayoutMeaning(), which provides a fallback |
| 92 // interpretation when there is no other way to map a physical key. |
88 const struct NonPrintableCodeEntry { | 93 const struct NonPrintableCodeEntry { |
89 DomCode dom_code; | 94 DomCode dom_code; |
90 DomKey dom_key; | 95 DomKey dom_key; |
91 base::char16 character; | 96 base::char16 character; |
92 } kNonPrintableCodeMap[] = { | 97 } kNonPrintableCodeMap[] = { |
93 {DomCode::ABORT, DomKey::CANCEL}, | 98 {DomCode::ABORT, DomKey::CANCEL}, |
94 {DomCode::AGAIN, DomKey::AGAIN}, | 99 {DomCode::AGAIN, DomKey::AGAIN}, |
95 {DomCode::ALT_LEFT, DomKey::ALT}, | 100 {DomCode::ALT_LEFT, DomKey::ALT}, |
96 {DomCode::ALT_RIGHT, DomKey::ALT}, | 101 {DomCode::ALT_RIGHT, DomKey::ALT}, |
97 {DomCode::ARROW_DOWN, DomKey::ARROW_DOWN}, | 102 {DomCode::ARROW_DOWN, DomKey::ARROW_DOWN}, |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 {DomCode::ENTER, VKEY_RETURN}, // 0x070028 Enter | 425 {DomCode::ENTER, VKEY_RETURN}, // 0x070028 Enter |
421 {DomCode::ESCAPE, VKEY_ESCAPE}, // 0x070029 Escape | 426 {DomCode::ESCAPE, VKEY_ESCAPE}, // 0x070029 Escape |
422 {DomCode::BACKSPACE, VKEY_BACK}, // 0x07002A Backspace | 427 {DomCode::BACKSPACE, VKEY_BACK}, // 0x07002A Backspace |
423 {DomCode::TAB, VKEY_TAB}, // 0x07002B Tab | 428 {DomCode::TAB, VKEY_TAB}, // 0x07002B Tab |
424 {DomCode::SPACE, VKEY_SPACE}, // 0x07002C Space | 429 {DomCode::SPACE, VKEY_SPACE}, // 0x07002C Space |
425 {DomCode::MINUS, VKEY_OEM_MINUS}, // 0x07002D Minus | 430 {DomCode::MINUS, VKEY_OEM_MINUS}, // 0x07002D Minus |
426 {DomCode::EQUAL, VKEY_OEM_PLUS}, // 0x07002E Equal | 431 {DomCode::EQUAL, VKEY_OEM_PLUS}, // 0x07002E Equal |
427 {DomCode::BRACKET_LEFT, VKEY_OEM_4}, // 0x07002F BracketLeft | 432 {DomCode::BRACKET_LEFT, VKEY_OEM_4}, // 0x07002F BracketLeft |
428 {DomCode::BRACKET_RIGHT, VKEY_OEM_6}, // 0x070030 BracketRight | 433 {DomCode::BRACKET_RIGHT, VKEY_OEM_6}, // 0x070030 BracketRight |
429 {DomCode::BACKSLASH, VKEY_OEM_5}, // 0x070031 Backslash | 434 {DomCode::BACKSLASH, VKEY_OEM_5}, // 0x070031 Backslash |
430 // DomCode::INTL_HASH, VKEY_OEM_5 // 0x070032 IntlHash | 435 {DomCode::INTL_HASH, VKEY_OEM_5}, // 0x070032 IntlHash |
431 {DomCode::SEMICOLON, VKEY_OEM_1}, // 0x070033 Semicolon | 436 {DomCode::SEMICOLON, VKEY_OEM_1}, // 0x070033 Semicolon |
432 {DomCode::QUOTE, VKEY_OEM_7}, // 0x070034 Quote | 437 {DomCode::QUOTE, VKEY_OEM_7}, // 0x070034 Quote |
433 {DomCode::BACKQUOTE, VKEY_OEM_3}, // 0x070035 Backquote | 438 {DomCode::BACKQUOTE, VKEY_OEM_3}, // 0x070035 Backquote |
434 {DomCode::COMMA, VKEY_OEM_COMMA}, // 0x070036 Comma | 439 {DomCode::COMMA, VKEY_OEM_COMMA}, // 0x070036 Comma |
435 {DomCode::PERIOD, VKEY_OEM_PERIOD}, // 0x070037 Period | 440 {DomCode::PERIOD, VKEY_OEM_PERIOD}, // 0x070037 Period |
436 {DomCode::SLASH, VKEY_OEM_2}, // 0x070038 Slash | 441 {DomCode::SLASH, VKEY_OEM_2}, // 0x070038 Slash |
437 {DomCode::CAPS_LOCK, VKEY_CAPITAL}, // 0x070039 CapsLock | 442 {DomCode::CAPS_LOCK, VKEY_CAPITAL}, // 0x070039 CapsLock |
438 {DomCode::F1, VKEY_F1}, // 0x07003A F1 | 443 {DomCode::F1, VKEY_F1}, // 0x07003A F1 |
439 {DomCode::F2, VKEY_F2}, // 0x07003B F2 | 444 {DomCode::F2, VKEY_F2}, // 0x07003B F2 |
440 {DomCode::F3, VKEY_F3}, // 0x07003C F3 | 445 {DomCode::F3, VKEY_F3}, // 0x07003C F3 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 VKEY_BROWSER_FAVORITES}, // 0x0C022A BrowserFavorites | 578 VKEY_BROWSER_FAVORITES}, // 0x0C022A BrowserFavorites |
574 {DomCode::ZOOM_TOGGLE, VKEY_ZOOM}, // 0x0C0232 ZoomToggle | 579 {DomCode::ZOOM_TOGGLE, VKEY_ZOOM}, // 0x0C0232 ZoomToggle |
575 }; | 580 }; |
576 | 581 |
577 // This table, used by UsLayoutKeyboardCodeToDomCode(), maps legacy | 582 // This table, used by UsLayoutKeyboardCodeToDomCode(), maps legacy |
578 // Windows-based VKEY values that are not part of kDomCodeToKeyboardCodeMap[] | 583 // Windows-based VKEY values that are not part of kDomCodeToKeyboardCodeMap[] |
579 // to suitable DomCode values, where practical. | 584 // to suitable DomCode values, where practical. |
580 const DomCodeToKeyboardCodeEntry kFallbackKeyboardCodeToDomCodeMap[] = { | 585 const DomCodeToKeyboardCodeEntry kFallbackKeyboardCodeToDomCodeMap[] = { |
581 {DomCode::ALT_LEFT, VKEY_MENU}, | 586 {DomCode::ALT_LEFT, VKEY_MENU}, |
582 {DomCode::ALT_RIGHT, VKEY_ALTGR}, | 587 {DomCode::ALT_RIGHT, VKEY_ALTGR}, |
583 {DomCode::BACKQUOTE, VKEY_DBE_SBCSCHAR}, | |
584 #if defined(OS_POSIX) | 588 #if defined(OS_POSIX) |
585 {DomCode::CONTEXT_MENU, VKEY_COMPOSE}, | 589 {DomCode::CONTEXT_MENU, VKEY_COMPOSE}, |
586 #endif | 590 #endif |
587 {DomCode::CONTROL_LEFT, VKEY_CONTROL}, | 591 {DomCode::CONTROL_LEFT, VKEY_CONTROL}, |
588 {DomCode::LANG1, VKEY_HANGUL}, | 592 {DomCode::LANG1, VKEY_HANGUL}, |
589 {DomCode::LANG2, VKEY_HANJA}, | 593 {DomCode::LANG2, VKEY_HANJA}, |
590 {DomCode::LANG5, VKEY_DBE_DBCSCHAR}, | 594 {DomCode::LANG5, VKEY_DBE_DBCSCHAR}, |
591 {DomCode::NUMPAD_CLEAR, VKEY_OEM_CLEAR}, | 595 {DomCode::NUMPAD_CLEAR, VKEY_OEM_CLEAR}, |
| 596 {DomCode::NUMPAD_DECIMAL, VKEY_SEPARATOR}, |
592 {DomCode::PROPS, VKEY_CRSEL}, | 597 {DomCode::PROPS, VKEY_CRSEL}, |
593 {DomCode::SHIFT_LEFT, VKEY_SHIFT}, | 598 {DomCode::SHIFT_LEFT, VKEY_SHIFT}, |
594 {DomCode::SUPER, VKEY_OEM_8}, | 599 {DomCode::SUPER, VKEY_OEM_8}, |
595 // | 600 // |
596 // VKEYs with no existing corresponding DomCode, but a USB usage code: | 601 // VKEYs with no directly corresponding DomCode, but a USB usage code: |
597 // {DomCode::SYS_REQ, VKEY_ATTN}, // 0x07009A SysReq | 602 // VKEY_ATTN // 0x07009A SysReq |
598 // {DomCode::SEPARATOR, VKEY_SEPARATOR}, // 0x07009F Separator | 603 // VKEY_SEPARATOR // 0x07009F Separator |
599 // {DomCode::EX_SEL, VKEY_EXSEL}, // 0x0700A4 ExSel | 604 // VKEY_EXSEL // 0x0700A4 ExSel |
600 // {DomCode::PRINT, VKEY_PRINT}, // 0x0C0208 AC Print | 605 // VKEY_PRINT // 0x0C0208 AC Print |
601 // {DomCode::MEDIA_PLAY, VKEY_PLAY}, // 0x0C00B0 MediaPlay | 606 // VKEY_PLAY // 0x0C00B0 MediaPlay |
602 // {DomCode::MEDIA_REWIND, VKEY_OEM_103}, // 0x0C00B4 MediaRewind | 607 // VKEY_OEM_103 // 0x0C00B4 MediaRewind |
603 // {DomCode::MEDIA_FAST_FORWARD, VKEY_OEM_104}, | 608 // VKEY_OEM_104 // 0x0C00B3 MediaFastForward |
604 // // 0x0C00B3 MediaFastForward | 609 // |
| 610 // VKEYs with no corresponding DomCode, but a Linux evdev usage code: |
| 611 // VKEY_KBD_BRIGHTNESS_DOWN // evdev KEY_KBDILLUMDOWN |
| 612 // VKEY_KBD_BRIGHTNESS_UP // evdev KEY_KBDILLUMUP |
| 613 // VKEY_WLAN // evdev KEY_WLAN |
605 // | 614 // |
606 // VKEYs with no corresponding DomCode and no obvious USB usage code: | 615 // VKEYs with no corresponding DomCode and no obvious USB usage code: |
607 // VKEY_ACCEPT | 616 // VKEY_ACCEPT |
608 // VKEY_BACKTAB | 617 // VKEY_BACKTAB |
| 618 // VKEY_DBE_SBCSCHAR |
609 // VKEY_EREOF | 619 // VKEY_EREOF |
610 // VKEY_FINAL | 620 // VKEY_FINAL |
611 // VKEY_JUNJA | 621 // VKEY_JUNJA |
612 // VKEY_KBD_BRIGHTNESS_DOWN | |
613 // VKEY_KBD_BRIGHTNESS_UP | |
614 // VKEY_MODECHANGE | 622 // VKEY_MODECHANGE |
615 // VKEY_NONAME | 623 // VKEY_NONAME |
616 // VKEY_PA1 | 624 // VKEY_PA1 |
617 // VKEY_PACKET | 625 // VKEY_PACKET |
618 // VKEY_PROCESSKEY | 626 // VKEY_PROCESSKEY |
619 // VKEY_WLAN | |
620 }; | 627 }; |
621 | 628 |
622 } // namespace ui | 629 } // namespace ui |
623 | 630 |
624 #endif // UI_EVENTS_KEYCODES_DOM_US_LAYOUT_DATA_H_ | 631 #endif // UI_EVENTS_KEYCODES_DOM_US_LAYOUT_DATA_H_ |
OLD | NEW |