OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 3 * |
| 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are |
| 6 * met: |
| 7 * |
| 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above |
| 11 * copyright notice, this list of conditions and the following disclaimer |
| 12 * in the documentation and/or other materials provided with the |
| 13 * distribution. |
| 14 * * Neither the name of Google Inc. nor the names of its |
| 15 * contributors may be used to endorse or promote products derived from |
| 16 * this software without specific prior written permission. |
| 17 * |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ |
| 30 |
| 31 #ifndef KeyboardCode_h |
| 32 #define KeyboardCode_h |
| 33 |
| 34 #include <platform/WindowsKeyboardCodes.h> |
| 35 |
| 36 struct UsbKeyToCodeMapEntry { |
| 37 int usbCode; |
| 38 int windowsKeyCode; |
| 39 const char* code; |
| 40 }; |
| 41 |
| 42 const UsbKeyToCodeMapEntry keyCodeMap[] = { |
| 43 // 2.1.1.1 AlphaNumeric Section |
| 44 {0x070035, VK_OEM_3, "Backquote"}, // `~ |
| 45 {0x070031, VK_OEM_5, "Backslash"}, // \| (US keyboard only} |
| 46 {0x07002a, VK_BACK, "Backspace"}, |
| 47 {0x07002f, VK_OEM_4, "BracketLeft"}, // [{ |
| 48 {0x070030, VK_OEM_6, "BracketRight"}, // ]} |
| 49 {0x070036, VK_OEM_COMMA, "Comma"}, // ,< |
| 50 {0x070027, VK_0, "Digit0"}, // 0) |
| 51 {0x07001e, VK_1, "Digit1"}, // 1! |
| 52 {0x07001f, VK_2, "Digit2"}, // 2@ |
| 53 {0x070020, VK_3, "Digit3"}, // 3# |
| 54 {0x070021, VK_4, "Digit4"}, // 4$ |
| 55 {0x070022, VK_5, "Digit5"}, // 5% |
| 56 {0x070023, VK_6, "Digit6"}, // 6^ |
| 57 {0x070024, VK_7, "Digit7"}, // 7& |
| 58 {0x070025, VK_8, "Digit8"}, // 8* |
| 59 {0x070026, VK_9, "Digit9"}, // 9( |
| 60 {0x07002e, VK_OEM_PLUS, "Equal"}, // =+ |
| 61 {0x070064, VK_NONAME, "IntlBackslash"}, // Non-US \| |
| 62 {0x070032, VK_NONAME, "IntlHash"}, // #~ (Non-US} |
| 63 {0x070087, VK_NONAME, "IntlRo"}, // Brazilian /? and Japanese _ 'ro'. |
| 64 {0x070089, VK_NONAME, "IntlYen"}, // Japanese |
| 65 {0x070004, VK_A, "KeyA"}, // aA |
| 66 {0x070005, VK_B, "KeyB"}, // bB |
| 67 {0x070006, VK_C, "KeyC"}, // cC |
| 68 {0x070007, VK_D, "KeyD"}, // dD |
| 69 {0x070008, VK_E, "KeyE"}, // eEo |
| 70 {0x070009, VK_F, "KeyF"}, // fF |
| 71 {0x07000a, VK_G, "KeyG"}, // gG |
| 72 {0x07000b, VK_H, "KeyH"}, // hH |
| 73 {0x07000c, VK_I, "KeyI"}, // iI |
| 74 {0x07000d, VK_J, "KeyJ"}, // jJ |
| 75 {0x07000e, VK_K, "KeyK"}, // kK |
| 76 {0x07000f, VK_L, "KeyL"}, // lL |
| 77 {0x070010, VK_M, "KeyM"}, // mM |
| 78 {0x070011, VK_N, "KeyN"}, // nN |
| 79 {0x070012, VK_O, "KeyO"}, // oO |
| 80 {0x070013, VK_P, "KeyP"}, // pP |
| 81 {0x070014, VK_Q, "KeyQ"}, // qQ |
| 82 {0x070015, VK_R, "KeyR"}, // rR |
| 83 {0x070016, VK_S, "KeyS"}, // sS |
| 84 {0x070017, VK_T, "KeyT"}, // tT |
| 85 {0x070018, VK_U, "KeyU"}, // uU |
| 86 {0x070019, VK_V, "KeyV"}, // vV |
| 87 {0x07001a, VK_W, "KeyW"}, // wW |
| 88 {0x07001b, VK_X, "KeyX"}, // xX |
| 89 {0x07001c, VK_Y, "KeyY"}, // yY |
| 90 {0x07001d, VK_Z, "KeyZ"}, // zZ |
| 91 {0x07002d, VK_OEM_MINUS, "Minus"}, // -_ |
| 92 {0x070037, VK_OEM_PERIOD, "Period"}, // .> |
| 93 {0x070034, VK_OEM_7, "Quote"}, // '" |
| 94 {0x070033, VK_OEM_1, "Semicolon"}, // ; |
| 95 {0x070038, VK_OEM_2, "Slash"}, // /? |
| 96 |
| 97 // 2.1.1.2 Functional Keys |
| 98 {0x0700e2, VK_LMENU, "AltLeft"}, // Alt or Option |
| 99 {0x0700e6, VK_RMENU, "AltRight"}, // Alt or Option or AltGr |
| 100 {0x070039, VK_CAPITAL, "CapsLock"}, |
| 101 {0x070065, VK_APPS, "ContextMenu"}, // Application context menu |
| 102 {0x0700e0, VK_LCONTROL, "ControlLeft"}, |
| 103 {0x0700e4, VK_RCONTROL, "ControlRight"}, |
| 104 {0x070028, VK_RETURN, "Enter"}, |
| 105 {0x0700e3, VK_LWIN, "OSLeft"}, |
| 106 {0x0700e7, VK_RWIN, "OSRight"}, |
| 107 {0x0700e1, VK_LSHIFT, "ShiftLeft"}, |
| 108 {0x0700e5, VK_RSHIFT, "ShiftRight"}, |
| 109 {0x07002c, VK_SPACE, "Space"}, // Spacebar |
| 110 {0x07002b, VK_TAB, "Tab"}, |
| 111 |
| 112 // Japanese/Korean Keyboard keys |
| 113 {0x07008a, VK_CONVERT, "Convert"}, // Japanese: 変換 (henkan) |
| 114 {0x070088, VK_KANA, "KanaMode"}, // Japanese: カタカナ/ひらがな/ローマ字 (katakana/hirag
ana/romaji) |
| 115 {0x070090, VK_NONAME, "Lang1"}, // Korean: 한/영 (han/yeong), Japanese (Mac ke
yboard): かな (kana) |
| 116 {0x070091, VK_HANJA, "Lang2"}, // Korean: 한자 (hanja), Japanese (Mac keyboar
d): 英数 (eisu) |
| 117 {0x070092, VK_NONAME, "Lang3"}, // Japanese (word-processing keyboard): Kata
kana |
| 118 {0x070093, VK_NONAME, "Lang4"}, // Japanese (word-processing keyboard): Hira
gana |
| 119 {0x070094, VK_NONAME, "Lang5"}, // Japanese (word-processing keyboard): Zenk
aku/Hankaku |
| 120 {0x07008b, VK_NONAME, "NonConvert"}, // Japanese: 無変換 (muhenkan) |
| 121 |
| 122 // 2.1.2 Control Pad |
| 123 {0x07004c, VK_DELETE, "Delete"}, |
| 124 {0x07004d, VK_END, "End"}, |
| 125 {0x070075, VK_HELP, "Help"}, |
| 126 {0x07004a, VK_HOME, "Home"}, |
| 127 {0x070049, VK_INSERT, "Insert"}, // Labeled "Help/Insert" on Mac. |
| 128 {0x07004e, VK_NEXT, "PageDown"}, |
| 129 {0x07004b, VK_PRIOR, "PageUp"}, |
| 130 |
| 131 // 2.1.3 Arrow Pad |
| 132 {0x070051, VK_DOWN, "ArrowDown"}, |
| 133 {0x070050, VK_LEFT, "ArrowLeft"}, |
| 134 {0x07004f, VK_RIGHT, "ArrowRight"}, |
| 135 {0x070052, VK_UP, "ArrowUp"}, |
| 136 |
| 137 // 2.1.4 Numpad |
| 138 {0x070053, VK_NUMLOCK, "NumLock"}, // On the Mac, the 'NumLock' code should
be used for the numpad 'Clear' key. |
| 139 {0x070062, VK_NUMPAD0, "Numpad0"}, // 0 and Insert |
| 140 {0x070059, VK_NUMPAD1, "Numpad1"}, // 1 and End |
| 141 {0x07005a, VK_NUMPAD2, "Numpad2"}, // 2 and ArrowDown |
| 142 {0x07005b, VK_NUMPAD3, "Numpad3"}, // 3 and PageDown |
| 143 {0x07005c, VK_NUMPAD4, "Numpad4"}, // 4 and ArrowLeft |
| 144 {0x07005d, VK_NUMPAD5, "Numpad5"}, // 5 |
| 145 {0x07005e, VK_NUMPAD6, "Numpad6"}, // 6 and ArrowRight |
| 146 {0x07005f, VK_NUMPAD7, "Numpad7"}, // 7 and Home |
| 147 {0x070060, VK_NUMPAD8, "Numpad8"}, // 8 and ArrowUp |
| 148 {0x070061, VK_NUMPAD9, "Numpad9"}, // 9 and PageUp |
| 149 {0x070057, VK_ADD, "NumpadAdd"}, // + |
| 150 {0x0700bb, VK_NONAME, "NumpadBackspace"}, // Found on the Microsoft Natural
Keyboard. |
| 151 {0x0700d8, VK_NONAME, "NumpadClear"}, // For use with numpads that have a 'C
lear' key that is separate from the 'NumLock' key. On the Mac, the numpad 'Clear
' key should always be encoded as 'NumLock'. |
| 152 {0x0700d9, VK_NONAME, "NumpadClearEntry"}, |
| 153 {0x070085, VK_SEPARATOR, "NumpadComma"}, // (thousands separator). For local
es where the thousands separator is a '.' (e.g., Brazil), this key may generate
a '.'. |
| 154 {0x070063, VK_SEPARATOR, "NumpadDecimal"}, // (decimal separator) and Delete
. For locales where the decimal separator is ',' (e.g., Brazil), this key may ge
nerate a ','. |
| 155 {0x070054, VK_DIVIDE, "NumpadDivide"}, // / |
| 156 {0x070058, VK_NONAME, "NumpadEnter"}, |
| 157 {0x070067, VK_NONAME, "NumpadEqual"}, // = |
| 158 {0x0700d3, VK_NONAME, "NumpadMemoryAdd"}, |
| 159 {0x0700d2, VK_NONAME, "NumpadMemoryClear"}, |
| 160 {0x0700d1, VK_NONAME, "NumpadMemoryRecall"}, |
| 161 {0x0700d0, VK_NONAME, "NumpadMemoryStore"}, |
| 162 {0x0700d4, VK_NONAME, "NumpadMemorySubtract"}, |
| 163 {0x070055, VK_MULTIPLY, "NumpadMultiply"}, // * |
| 164 {0x0700b6, VK_NONAME, "NumpadParenLeft"}, // ( Found on the Microsoft Natura
l Keyboard. |
| 165 {0x0700b7, VK_NONAME, "NumpadParenRight"}, // ) Found on the Microsoft Natur
al Keyboard. |
| 166 {0x070056, VK_SUBTRACT, "NumpadSubtract"}, // - |
| 167 |
| 168 // 2.1.5 Function Section |
| 169 {0x070029, VK_ESCAPE, "Escape"}, |
| 170 {0x07003a, VK_F1, "F1"}, |
| 171 {0x07003b, VK_F2, "F2"}, |
| 172 {0x07003c, VK_F3, "F3"}, |
| 173 {0x07003d, VK_F4, "F4"}, |
| 174 {0x07003e, VK_F5, "F5"}, |
| 175 {0x07003f, VK_F6, "F6"}, |
| 176 {0x070040, VK_F7, "F7"}, |
| 177 {0x070041, VK_F8, "F8"}, |
| 178 {0x070042, VK_F9, "F9"}, |
| 179 {0x070043, VK_F10, "F10"}, |
| 180 {0x070044, VK_F11, "F11"}, |
| 181 {0x070045, VK_F12, "F12"}, |
| 182 // Fn |
| 183 // FLock |
| 184 {0x070046, VK_SNAPSHOT, "PrintScreen"}, // PrintScreen is effectively F13 on
Mac OS X. |
| 185 {0x070047, VK_SCROLL, "ScrollLock"}, |
| 186 {0x070048, VK_PAUSE, "Pause"}, |
| 187 }; |
| 188 |
| 189 #endif /* KeyboardCode_h */ |
OLD | NEW |