Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1894)

Side by Side Diff: Source/core/events/KeyboardCode.h

Issue 663523002: Adding support for DOM3 KeyboardEvents Code in KeyboardEvents (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use native code instead of usb code mapping. Also updated to match firefox values. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 #if defined (__linux)
35 #define NATIVETOCODE(linux, win, mac, code) {linux, code}
36 #elif defined(_WIN32)
37 #define NATIVETOCODE(linux, win, mac, code) {win, code}
38 #elif defined(__APPLE__)
39 #define NATIVETOCODE(linux, win, mac, code) {mac, code}
40 #else
41 #define NATIVETOCODE(linux, win, mac, code) {0, code}
42 #endif
43
44 struct NativeCodeToCodeMapEntry {
45 int nativeCode;
46 const char* code;
47 };
48
49 const NativeCodeToCodeMapEntry keyCodeMap[] = {
Wez 2014/10/25 00:23:02 As previously discussed, Chromium already has this
Habib Virji 2014/10/27 16:48:36 I have added a new embedder API, this file is remo
50 // 2.1.1.1 AlphaNumeric Section
51 NATIVETOCODE(0x0031, 0x0029, 0x0032, "Backquote"),
52 NATIVETOCODE(0x0033, 0x002b, 0x002a, "Backslash"),
53 NATIVETOCODE(0x0016, 0x000e, 0x0033, "Backspace"),
54 NATIVETOCODE(0x0022, 0x001a, 0x0021, "BracketLeft"),
55 NATIVETOCODE(0x0023, 0x001b, 0x001e, "BracketRight"),
56 NATIVETOCODE(0x003b, 0x0033, 0x002b, "Comma"),
57 NATIVETOCODE(0x0013, 0x000b, 0x001d, "Digit0"),
58 NATIVETOCODE(0x000a, 0x0002, 0x0012, "Digit1"),
59 NATIVETOCODE(0x000b, 0x0003, 0x0013, "Digit2"),
60 NATIVETOCODE(0x000c, 0x0004, 0x0014, "Digit3"),
61 NATIVETOCODE(0x000d, 0x0005, 0x0015, "Digit4"),
62 NATIVETOCODE(0x000e, 0x0006, 0x0017, "Digit5"),
63 NATIVETOCODE(0x000f, 0x0007, 0x0016, "Digit6"),
64 NATIVETOCODE(0x0010, 0x0008, 0x001a, "Digit7"),
65 NATIVETOCODE(0x0011, 0x0009, 0x001c, "Digit8"),
66 NATIVETOCODE(0x0012, 0x000a, 0x0019, "Digit9"),
67 NATIVETOCODE(0x0015, 0x000d, 0x0018, "Equal"),
68 NATIVETOCODE(0x005e, 0x0056, 0x000a, "IntlBackslash"),
69 NATIVETOCODE(0x0061, 0x0073, 0x005e, "IntlRo"),
70 NATIVETOCODE(0x0084, 0x007d, 0x005d, "IntlYen"),
71 NATIVETOCODE(0x0026, 0x001e, 0x0000, "KeyA"),
72 NATIVETOCODE(0x0038, 0x0030, 0x000b, "KeyB"),
73 NATIVETOCODE(0x0036, 0x002e, 0x0008, "KeyC"),
74 NATIVETOCODE(0x0028, 0x0020, 0x0002, "KeyD"),
75 NATIVETOCODE(0x001a, 0x0012, 0x000e, "KeyE"),
76 NATIVETOCODE(0x0029, 0x0021, 0x0003, "KeyF"),
77 NATIVETOCODE(0x002a, 0x0022, 0x0005, "KeyG"),
78 NATIVETOCODE(0x002b, 0x0023, 0x0004, "KeyH"),
79 NATIVETOCODE(0x001f, 0x0017, 0x0022, "KeyI"),
80 NATIVETOCODE(0x002c, 0x0024, 0x0026, "KeyJ"),
81 NATIVETOCODE(0x002d, 0x0025, 0x0028, "KeyK"),
82 NATIVETOCODE(0x002e, 0x0026, 0x0025, "KeyL"),
83 NATIVETOCODE(0x003a, 0x0032, 0x002e, "KeyM"),
84 NATIVETOCODE(0x0039, 0x0031, 0x002d, "KeyN"),
85 NATIVETOCODE(0x0020, 0x0018, 0x001f, "KeyO"),
86 NATIVETOCODE(0x0021, 0x0019, 0x0023, "KeyP"),
87 NATIVETOCODE(0x0018, 0x0010, 0x000c, "KeyQ"),
88 NATIVETOCODE(0x001b, 0x0013, 0x000f, "KeyR"),
89 NATIVETOCODE(0x0027, 0x001f, 0x0001, "KeyS"),
90 NATIVETOCODE(0x001c, 0x0014, 0x0011, "KeyT"),
91 NATIVETOCODE(0x001e, 0x0016, 0x0020, "KeyU"),
92 NATIVETOCODE(0x0037, 0x002f, 0x0009, "KeyV"),
93 NATIVETOCODE(0x0019, 0x0011, 0x000d, "KeyW"),
94 NATIVETOCODE(0x0035, 0x002d, 0x0007, "KeyX"),
95 NATIVETOCODE(0x001d, 0x0015, 0x0010, "KeyY"),
96 NATIVETOCODE(0x0034, 0x002c, 0x0006, "KeyZ"),
97 NATIVETOCODE(0x0014, 0x000c, 0x001b, "Minus"),
98 NATIVETOCODE(0x003c, 0x0034, 0x002f, "Period"),
99 NATIVETOCODE(0x0030, 0x0028, 0x0027, "Quote"),
100 NATIVETOCODE(0x002f, 0x0027, 0x0029, "Semicolon"),
101 NATIVETOCODE(0x003d, 0x0035, 0x002c, "Slash"),
102
103 // 2.1.1.2 Functional Keys
104 NATIVETOCODE(0x0040, 0x0038, 0x003a, "AltLeft"),
105 NATIVETOCODE(0x006c, 0xe038, 0x003d, "AltRight"),
106 NATIVETOCODE(0x005c, 0x0000, 0xffff, "AltRight"),
107 NATIVETOCODE(0x0042, 0x003a, 0x0039, "CapsLock"),
108 NATIVETOCODE(0x0087, 0xe05d, 0x006e, "ContextMenu"),
109 NATIVETOCODE(0x0025, 0x001d, 0x003b, "ControlLeft"),
110 NATIVETOCODE(0x0069, 0xe01d, 0x003e, "ControlRight"),
111 NATIVETOCODE(0x0024, 0x001c, 0x0024, "Enter"),
112 NATIVETOCODE(0x0085, 0xe05b, 0x0037, "OSLeft"),
113 NATIVETOCODE(0x0086, 0xe05c, 0x0036, "OSRight"),
114 NATIVETOCODE(0x0032, 0x002a, 0x0038, "ShiftLeft"),
115 NATIVETOCODE(0x003e, 0x0036, 0x003c, "ShiftRight"),
116 NATIVETOCODE(0x0041, 0x0039, 0x0031, "Space"),
117 NATIVETOCODE(0x0017, 0x000f, 0x0030, "Tab"),
118
119 // Japanese/Korean Keyboard keys
120 NATIVETOCODE(0x0064, 0x0079, 0xffff, "Convert"),
121 NATIVETOCODE(0x0065, 0x0070, 0xffff, "KanaMode"),
122 NATIVETOCODE(0x0082, 0x0072, 0xffff, "Lang1"),
123 NATIVETOCODE(0x0082, 0xe072, 0xffff, "Lang1"),
124 NATIVETOCODE(0x0083, 0x0071, 0xffff, "Lang2"),
125 NATIVETOCODE(0x0083, 0xe0f1, 0xffff, "Lang2"),
126 NATIVETOCODE(0x0066, 0x007b, 0xffff, "NoConvert"),
127
128 // 2.1.2 Control Pad
129 NATIVETOCODE(0x0077, 0xe053, 0x0075, "Delete"),
130 NATIVETOCODE(0x0073, 0xe04f, 0x0077, "End"),
131 NATIVETOCODE(0x0092, 0xe03b, 0x0072, "Help"),
132 NATIVETOCODE(0x006e, 0xe047, 0x0073, "Home"),
133 NATIVETOCODE(0x0076, 0xe052, 0xffff, "Insert"),
134 NATIVETOCODE(0x0075, 0xe051, 0x0079, "PageDown"),
135 NATIVETOCODE(0x0070, 0xe049, 0x0074, "PageUp"),
136
137 // 2.1.3 Arrow Pad
138 NATIVETOCODE(0x0074, 0xe050, 0x007d, "ArrowDown"),
139 NATIVETOCODE(0x0071, 0xe04b, 0x007b, "ArrowLeft"),
140 NATIVETOCODE(0x0072, 0xe04d, 0x007c, "ArrowRight"),
141 NATIVETOCODE(0x006f, 0xe048, 0x007e, "ArrowUp"),
142
143 // 2.1.4 Numpad
144 NATIVETOCODE(0x004d, 0x0045, 0x0047, "NumLock"),
145 NATIVETOCODE(0x005a, 0x0052, 0x0052, "Numpad0"),
146 NATIVETOCODE(0x0057, 0x004f, 0x0053, "Numpad1"),
147 NATIVETOCODE(0x0058, 0x0050, 0x0054, "Numpad2"),
148 NATIVETOCODE(0x0059, 0x0051, 0x0055, "Numpad3"),
149 NATIVETOCODE(0x0053, 0x004b, 0x0056, "Numpad4"),
150 NATIVETOCODE(0x0054, 0x004c, 0x0057, "Numpad5"),
151 NATIVETOCODE(0x0055, 0x004d, 0x0058, "Numpad6"),
152 NATIVETOCODE(0x004f, 0x0047, 0x0059, "Numpad7"),
153 NATIVETOCODE(0x0050, 0x0048, 0x005b, "Numpad8"),
154 NATIVETOCODE(0x0051, 0x0049, 0x005c, "Numpad9"),
155 NATIVETOCODE(0x0056, 0x004e, 0x0045, "NumpadAdd"),
156 NATIVETOCODE(0x0081, 0x007e, 0x005f, "NumpadComma"),
157 NATIVETOCODE(0x005b, 0x0053, 0x0041, "NumpadDecimal"),
158 NATIVETOCODE(0x006a, 0xe035, 0x004b, "NumpadDivide"),
159 NATIVETOCODE(0x0068, 0xe01c, 0x004c, "NumpadEnter"),
160 NATIVETOCODE(0x007d, 0x0059, 0x0051, "NumpadEqual"),
161 NATIVETOCODE(0x003f, 0x0037, 0x0043, "NumpadMultiply"),
162 NATIVETOCODE(0x0052, 0x004a, 0x004e, "NumpadSubtract"),
163 NATIVETOCODE(0x00bb, 0x0000, 0xffff, "NumpadParenLeft"),
164 NATIVETOCODE(0x00bc, 0x0000, 0xffff, "NumpadParenRight"),
165
166 // 2.1.5 Function Section
167 NATIVETOCODE(0x0009, 0x0001, 0x0035, "Escape"),
168 NATIVETOCODE(0x0043, 0x003b, 0x007a, "F1"),
169 NATIVETOCODE(0x0044, 0x003c, 0x0078, "F2"),
170 NATIVETOCODE(0x0045, 0x003d, 0x0063, "F3"),
171 NATIVETOCODE(0x0046, 0x003e, 0x0076, "F4"),
172 NATIVETOCODE(0x0047, 0x003f, 0x0060, "F5"),
173 NATIVETOCODE(0x0048, 0x0040, 0x0061, "F6"),
174 NATIVETOCODE(0x0049, 0x0041, 0x0062, "F7"),
175 NATIVETOCODE(0x004a, 0x0042, 0x0064, "F8"),
176 NATIVETOCODE(0x004b, 0x0043, 0x0065, "F9"),
177 NATIVETOCODE(0x004c, 0x0044, 0x006d, "F10"),
178 NATIVETOCODE(0x005f, 0x0057, 0x0067, "F11"),
179 NATIVETOCODE(0x0060, 0x0058, 0x006f, "F12"),
180 NATIVETOCODE(0x006b, 0xe037, 0xffff, "PrintScreen"),
181 NATIVETOCODE(0x006b, 0x0054, 0xffff, "PrintScreen"),
182 NATIVETOCODE(0x004e, 0x0046, 0xffff, "ScrollLock"),
183 NATIVETOCODE(0x007f, 0x0045, 0xffff, "Pause"),
184 NATIVETOCODE(0x007f, 0xe046, 0xffff, "Pause"),
185
186 // 2.1.6 Media Keys
187 NATIVETOCODE(0x00a6, 0xe06a, 0xffff, "BrowserBack"),
188 NATIVETOCODE(0x00a4, 0xe066, 0xffff, "BrowserFavorites"),
189 NATIVETOCODE(0x00a7, 0xe069, 0xffff, "BrowserForward"),
190 NATIVETOCODE(0x00b4, 0xe032, 0xffff, "BrowserHome"),
191 NATIVETOCODE(0x00b5, 0xe067, 0xffff, "BrowserRefresh"),
192 NATIVETOCODE(0x00e1, 0xe065, 0xffff, "BrowserSearch"),
193 NATIVETOCODE(0x0088, 0xe068, 0xffff, "BrowserStop"),
194 NATIVETOCODE(0x00a9, 0xe02c, 0xffff, "Eject"),
195 NATIVETOCODE(0x0098, 0xe06B, 0xffff, "LaunchApp1"),
196 NATIVETOCODE(0x0094, 0xe021, 0xffff, "LaunchApp2"),
197 NATIVETOCODE(0x00a3, 0xe06c, 0xffff, "LaunchMail"),
198 NATIVETOCODE(0x00ac, 0xe022, 0xffff, "MediaPlayPause"),
199 NATIVETOCODE(0x00B3, 0xE06D, 0xffff, "MediaSelect"),
200 NATIVETOCODE(0x00ae, 0xe024, 0xffff, "MediaStop"),
201 NATIVETOCODE(0x00ab, 0xe019, 0xffff, "MediaTrackNext"),
202 NATIVETOCODE(0x00ad, 0xe010, 0xffff, "MediaTrackPrevious"),
203 NATIVETOCODE(0x007c, 0xe05e, 0x007f, "Power"),
204 NATIVETOCODE(0x0096, 0x0000, 0xffff, "Sleep"),
205 NATIVETOCODE(0x007a, 0xe02e, 0x0049, "VolumeDown"),
206 NATIVETOCODE(0x0079, 0xe020, 0x004a, "VolumeMute"),
207 NATIVETOCODE(0x007b, 0xe030, 0x0048, "VolumeUp"),
208 NATIVETOCODE(0x0097, 0x0000, 0xffff, "WakeUp"),
209 };
210
211 #endif /* KeyboardCode_h */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698