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

Side by Side Diff: Source/core/platform/chromium/KeyCodeConversionGtk.cpp

Issue 111403004: Move remaining KeyCode files to platform/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 7 years 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
4 * Copyright (C) 2007 Holger Hans Peter Freyther
5 * Copyright (C) 2008 Collabora, Ltd. All rights reserved.
6 * Copyright (C) 2008, 2009 Google Inc.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
21 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30 // windowsKeyCodeForKeyEvent is copied from platform/gtk/KeyEventGtk.cpp
31
32 #include "config.h"
33 #include "core/platform/chromium/KeyCodeConversion.h"
34
35 #include "platform/KeyboardCodes.h"
36
37 #include <gdk/gdkkeysyms.h>
38
39 namespace WebCore {
40
41 int windowsKeyCodeForKeyEvent(unsigned keycode)
42 {
43 switch (keycode) {
44 case GDK_KP_0:
45 return VKEY_NUMPAD0; // (60) Numeric keypad 0 key
46 case GDK_KP_1:
47 return VKEY_NUMPAD1; // (61) Numeric keypad 1 key
48 case GDK_KP_2:
49 return VKEY_NUMPAD2; // (62) Numeric keypad 2 key
50 case GDK_KP_3:
51 return VKEY_NUMPAD3; // (63) Numeric keypad 3 key
52 case GDK_KP_4:
53 return VKEY_NUMPAD4; // (64) Numeric keypad 4 key
54 case GDK_KP_5:
55 return VKEY_NUMPAD5; //(65) Numeric keypad 5 key
56 case GDK_KP_6:
57 return VKEY_NUMPAD6; // (66) Numeric keypad 6 key
58 case GDK_KP_7:
59 return VKEY_NUMPAD7; // (67) Numeric keypad 7 key
60 case GDK_KP_8:
61 return VKEY_NUMPAD8; // (68) Numeric keypad 8 key
62 case GDK_KP_9:
63 return VKEY_NUMPAD9; // (69) Numeric keypad 9 key
64 case GDK_KP_Multiply:
65 return VKEY_MULTIPLY; // (6A) Multiply key
66 case GDK_KP_Add:
67 return VKEY_ADD; // (6B) Add key
68 case GDK_KP_Subtract:
69 return VKEY_SUBTRACT; // (6D) Subtract key
70 case GDK_KP_Decimal:
71 return VKEY_DECIMAL; // (6E) Decimal key
72 case GDK_KP_Divide:
73 return VKEY_DIVIDE; // (6F) Divide key
74
75 case GDK_KP_Page_Up:
76 return VKEY_PRIOR; // (21) PAGE UP key
77 case GDK_KP_Page_Down:
78 return VKEY_NEXT; // (22) PAGE DOWN key
79 case GDK_KP_End:
80 return VKEY_END; // (23) END key
81 case GDK_KP_Home:
82 return VKEY_HOME; // (24) HOME key
83 case GDK_KP_Left:
84 return VKEY_LEFT; // (25) LEFT ARROW key
85 case GDK_KP_Up:
86 return VKEY_UP; // (26) UP ARROW key
87 case GDK_KP_Right:
88 return VKEY_RIGHT; // (27) RIGHT ARROW key
89 case GDK_KP_Down:
90 return VKEY_DOWN; // (28) DOWN ARROW key
91 case GDK_KP_Begin:
92 return VKEY_CLEAR; // (12) CLEAR key
93 case GDK_KP_Insert:
94 return VKEY_INSERT; // (45) INS key
95 case GDK_KP_Delete:
96 return VKEY_DELETE; // (46) DEL key
97
98 case GDK_BackSpace:
99 return VKEY_BACK; // (08) BACKSPACE key
100 case GDK_ISO_Left_Tab:
101 case GDK_3270_BackTab:
102 case GDK_Tab:
103 return VKEY_TAB; // (09) TAB key
104 case GDK_Clear:
105 return VKEY_CLEAR; // (0C) CLEAR key
106 case GDK_ISO_Enter:
107 case GDK_KP_Enter:
108 case GDK_Return:
109 return VKEY_RETURN; //(0D) Return key
110 case GDK_Shift_L:
111 return VKEY_LSHIFT; // (A0) Left SHIFT key
112 case GDK_Shift_R:
113 return VKEY_RSHIFT; // (A1) Right SHIFT key
114 case GDK_Control_L:
115 return VKEY_LCONTROL; // (A2) Left CTRL key
116 case GDK_Control_R:
117 return VKEY_RCONTROL; // (A3) Right CTRL key
118 case GDK_Menu:
119 return VKEY_APPS; // (5D) Applications key (Natural keyboard)
120 case GDK_Alt_L:
121 case GDK_Meta_L:
122 return VKEY_LMENU; // (A4) Left ALT key
123 case GDK_Alt_R:
124 case GDK_Meta_R:
125 case GDK_ISO_Level3_Shift:
126 return VKEY_RMENU; // (A5) Right ALT key
127
128 case GDK_Pause:
129 return VKEY_PAUSE; // (13) PAUSE key
130 case GDK_Caps_Lock:
131 return VKEY_CAPITAL; // (14) CAPS LOCK key
132 case GDK_Kana_Lock:
133 case GDK_Kana_Shift:
134 return VKEY_KANA; // (15) Input Method Editor (IME) Kana mode
135 case GDK_Hangul:
136 return VKEY_HANGUL; // VKEY_HANGUL (15) IME Hangul mode
137 // VKEY_JUNJA (17) IME Junja mode
138 // VKEY_FINAL (18) IME final mode
139 case GDK_Hangul_Hanja:
140 return VKEY_HANJA; // (19) IME Hanja mode
141 case GDK_Kanji:
142 return VKEY_KANJI; // (19) IME Kanji mode
143 case GDK_Escape:
144 return VKEY_ESCAPE; // (1B) ESC key
145 // VKEY_CONVERT (1C) IME convert
146 // VKEY_NONCONVERT (1D) IME nonconvert
147 // VKEY_ACCEPT (1E) IME accept
148 // VKEY_MODECHANGE (1F) IME mode change request
149 case GDK_space:
150 return VKEY_SPACE; // (20) SPACEBAR
151 case GDK_Page_Up:
152 return VKEY_PRIOR; // (21) PAGE UP key
153 case GDK_Page_Down:
154 return VKEY_NEXT; // (22) PAGE DOWN key
155 case GDK_End:
156 return VKEY_END; // (23) END key
157 case GDK_Home:
158 return VKEY_HOME; // (24) HOME key
159 case GDK_Left:
160 return VKEY_LEFT; // (25) LEFT ARROW key
161 case GDK_Up:
162 return VKEY_UP; // (26) UP ARROW key
163 case GDK_Right:
164 return VKEY_RIGHT; // (27) RIGHT ARROW key
165 case GDK_Down:
166 return VKEY_DOWN; // (28) DOWN ARROW key
167 case GDK_Select:
168 return VKEY_SELECT; // (29) SELECT key
169 case GDK_Print:
170 return VKEY_PRINT; // (2A) PRINT key
171 case GDK_Execute:
172 return VKEY_EXECUTE;// (2B) EXECUTE key
173 //dunno on this
174 //case GDK_PrintScreen:
175 // return VKEY_SNAPSHOT; // (2C) PRINT SCREEN key
176 case GDK_Insert:
177 return VKEY_INSERT; // (2D) INS key
178 case GDK_Delete:
179 return VKEY_DELETE; // (2E) DEL key
180 case GDK_Help:
181 return VKEY_HELP; // (2F) HELP key
182 case GDK_0:
183 case GDK_parenright:
184 return VKEY_0; // (30) 0) key
185 case GDK_1:
186 case GDK_exclam:
187 return VKEY_1; // (31) 1 ! key
188 case GDK_2:
189 case GDK_at:
190 return VKEY_2; // (32) 2 & key
191 case GDK_3:
192 case GDK_numbersign:
193 return VKEY_3; //case '3': case '#';
194 case GDK_4:
195 case GDK_dollar: // (34) 4 key '$';
196 return VKEY_4;
197 case GDK_5:
198 case GDK_percent:
199 return VKEY_5; // (35) 5 key '%'
200 case GDK_6:
201 case GDK_asciicircum:
202 return VKEY_6; // (36) 6 key '^'
203 case GDK_7:
204 case GDK_ampersand:
205 return VKEY_7; // (37) 7 key case '&'
206 case GDK_8:
207 case GDK_asterisk:
208 return VKEY_8; // (38) 8 key '*'
209 case GDK_9:
210 case GDK_parenleft:
211 return VKEY_9; // (39) 9 key '('
212 case GDK_a:
213 case GDK_A:
214 return VKEY_A; // (41) A key case 'a': case 'A': return 0x41;
215 case GDK_b:
216 case GDK_B:
217 return VKEY_B; // (42) B key case 'b': case 'B': return 0x42;
218 case GDK_c:
219 case GDK_C:
220 return VKEY_C; // (43) C key case 'c': case 'C': return 0x43;
221 case GDK_d:
222 case GDK_D:
223 return VKEY_D; // (44) D key case 'd': case 'D': return 0x44;
224 case GDK_e:
225 case GDK_E:
226 return VKEY_E; // (45) E key case 'e': case 'E': return 0x45;
227 case GDK_f:
228 case GDK_F:
229 return VKEY_F; // (46) F key case 'f': case 'F': return 0x46;
230 case GDK_g:
231 case GDK_G:
232 return VKEY_G; // (47) G key case 'g': case 'G': return 0x47;
233 case GDK_h:
234 case GDK_H:
235 return VKEY_H; // (48) H key case 'h': case 'H': return 0x48;
236 case GDK_i:
237 case GDK_I:
238 return VKEY_I; // (49) I key case 'i': case 'I': return 0x49;
239 case GDK_j:
240 case GDK_J:
241 return VKEY_J; // (4A) J key case 'j': case 'J': return 0x4A;
242 case GDK_k:
243 case GDK_K:
244 return VKEY_K; // (4B) K key case 'k': case 'K': return 0x4B;
245 case GDK_l:
246 case GDK_L:
247 return VKEY_L; // (4C) L key case 'l': case 'L': return 0x4C;
248 case GDK_m:
249 case GDK_M:
250 return VKEY_M; // (4D) M key case 'm': case 'M': return 0x4D;
251 case GDK_n:
252 case GDK_N:
253 return VKEY_N; // (4E) N key case 'n': case 'N': return 0x4E;
254 case GDK_o:
255 case GDK_O:
256 return VKEY_O; // (4F) O key case 'o': case 'O': return 0x4F;
257 case GDK_p:
258 case GDK_P:
259 return VKEY_P; // (50) P key case 'p': case 'P': return 0x50;
260 case GDK_q:
261 case GDK_Q:
262 return VKEY_Q; // (51) Q key case 'q': case 'Q': return 0x51;
263 case GDK_r:
264 case GDK_R:
265 return VKEY_R; // (52) R key case 'r': case 'R': return 0x52;
266 case GDK_s:
267 case GDK_S:
268 return VKEY_S; // (53) S key case 's': case 'S': return 0x53;
269 case GDK_t:
270 case GDK_T:
271 return VKEY_T; // (54) T key case 't': case 'T': return 0x54;
272 case GDK_u:
273 case GDK_U:
274 return VKEY_U; // (55) U key case 'u': case 'U': return 0x55;
275 case GDK_v:
276 case GDK_V:
277 return VKEY_V; // (56) V key case 'v': case 'V': return 0x56;
278 case GDK_w:
279 case GDK_W:
280 return VKEY_W; // (57) W key case 'w': case 'W': return 0x57;
281 case GDK_x:
282 case GDK_X:
283 return VKEY_X; // (58) X key case 'x': case 'X': return 0x58;
284 case GDK_y:
285 case GDK_Y:
286 return VKEY_Y; // (59) Y key case 'y': case 'Y': return 0x59;
287 case GDK_z:
288 case GDK_Z:
289 return VKEY_Z; // (5A) Z key case 'z': case 'Z': return 0x5A;
290 case GDK_Super_L:
291 return VKEY_LWIN; // (5B) Left Windows key (Microsoft Natural keyboard)
292 case GDK_Super_R:
293 return VKEY_RWIN; // (5C) Right Windows key (Natural keyboard)
294 // VKEY_SLEEP (5F) Computer Sleep key
295 // VKEY_SEPARATOR (6C) Separator key
296 // VKEY_SUBTRACT (6D) Subtract key
297 // VKEY_DECIMAL (6E) Decimal key
298 // VKEY_DIVIDE (6F) Divide key
299 // handled by key code above
300
301 case GDK_Num_Lock:
302 return VKEY_NUMLOCK; // (90) NUM LOCK key
303
304 case GDK_Scroll_Lock:
305 return VKEY_SCROLL; // (91) SCROLL LOCK key
306
307 // VKEY_LSHIFT (A0) Left SHIFT key
308 // VKEY_RSHIFT (A1) Right SHIFT key
309 // VKEY_LCONTROL (A2) Left CONTROL key
310 // VKEY_RCONTROL (A3) Right CONTROL key
311 // VKEY_LMENU (A4) Left MENU key
312 // VKEY_RMENU (A5) Right MENU key
313 case GDK_Back:
314 return VKEY_BROWSER_BACK; // (A6) Windows 2000/XP: Browser Back key
315 case GDK_Forward:
316 return VKEY_BROWSER_FORWARD; // (A7) Windows 2000/XP: Browser Forward ke y
317 case GDK_Refresh:
318 return VKEY_BROWSER_REFRESH; // (A8) Windows 2000/XP: Browser Refresh ke y
319 case GDK_Stop:
320 return VKEY_BROWSER_STOP; // (A9) Windows 2000/XP: Browser Stop key
321 case GDK_Search:
322 return VKEY_BROWSER_SEARCH; // (AA) Windows 2000/XP: Browser Search key
323 case GDK_Favorites:
324 return VKEY_BROWSER_FAVORITES; // (AB) Windows 2000/XP: Browser Favorite s key
325 case GDK_HomePage:
326 return VKEY_BROWSER_HOME; // (AC) Windows 2000/XP: Browser Start and Hom e key
327 case GDK_AudioMute:
328 return VKEY_VOLUME_MUTE; // (AD) Windows 2000/XP: Volume Mute key
329 case GDK_AudioLowerVolume:
330 return VKEY_VOLUME_DOWN; // (AE) Windows 2000/XP: Volume Down key
331 case GDK_AudioRaiseVolume:
332 return VKEY_VOLUME_UP; // (AF) Windows 2000/XP: Volume Up key
333 case GDK_AudioNext:
334 return VKEY_MEDIA_NEXT_TRACK; // (B0) Windows 2000/XP: Next Track key
335 case GDK_AudioPrev:
336 return VKEY_MEDIA_PREV_TRACK; // (B1) Windows 2000/XP: Previous Track ke y
337 case GDK_AudioStop:
338 return VKEY_MEDIA_STOP; // (B2) Windows 2000/XP: Stop Media key
339 case GDK_AudioPlay:
340 return VKEY_MEDIA_PLAY_PAUSE; // (B3) Windows 2000/XP: Play/Pause Media key
341 case GDK_Mail:
342 return VKEY_MEDIA_LAUNCH_MAIL; // (B4) Windows 2000/XP: Start Mail key
343 // VKEY_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key
344 case GDK_LaunchA:
345 return VKEY_MEDIA_LAUNCH_APP1; // (B6) Windows 2000/XP: Start Applicatio n 1 key
346 case GDK_LaunchB:
347 return VKEY_MEDIA_LAUNCH_APP2; // (B7) Windows 2000/XP: Start Applicatio n 2 key
348
349 // VKEY_OEM_1 (BA) Used for miscellaneous characters; it can vary by key board. Windows 2000/XP: For the US standard keyboard, the ';:' key
350 case GDK_semicolon:
351 case GDK_colon:
352 return VKEY_OEM_1; //case ';': case ':': return 0xBA;
353 // VKEY_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' k ey
354 case GDK_plus:
355 case GDK_equal:
356 return VKEY_OEM_PLUS; //case '=': case '+': return 0xBB;
357 // VKEY_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key
358 case GDK_comma:
359 case GDK_less:
360 return VKEY_OEM_COMMA; //case ',': case '<': return 0xBC;
361 // VKEY_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key
362 case GDK_minus:
363 case GDK_underscore:
364 return VKEY_OEM_MINUS; //case '-': case '_': return 0xBD;
365 // VKEY_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key
366 case GDK_period:
367 case GDK_greater:
368 return VKEY_OEM_PERIOD; //case '.': case '>': return 0xBE;
369 // VKEY_OEM_2 (BF) Used for miscellaneous characters; it can vary by key board. Windows 2000/XP: For the US standard keyboard, the '/?' key
370 case GDK_slash:
371 case GDK_question:
372 return VKEY_OEM_2; //case '/': case '?': return 0xBF;
373 // VKEY_OEM_3 (C0) Used for miscellaneous characters; it can vary by key board. Windows 2000/XP: For the US standard keyboard, the '`~' key
374 case GDK_asciitilde:
375 case GDK_quoteleft:
376 return VKEY_OEM_3; //case '`': case '~': return 0xC0;
377 // VKEY_OEM_4 (DB) Used for miscellaneous characters; it can vary by key board. Windows 2000/XP: For the US standard keyboard, the '[{' key
378 case GDK_bracketleft:
379 case GDK_braceleft:
380 return VKEY_OEM_4; //case '[': case '{': return 0xDB;
381 // VKEY_OEM_5 (DC) Used for miscellaneous characters; it can vary by key board. Windows 2000/XP: For the US standard keyboard, the '\|' key
382 case GDK_backslash:
383 case GDK_bar:
384 return VKEY_OEM_5; //case '\\': case '|': return 0xDC;
385 // VKEY_OEM_6 (DD) Used for miscellaneous characters; it can vary by key board. Windows 2000/XP: For the US standard keyboard, the ']}' key
386 case GDK_bracketright:
387 case GDK_braceright:
388 return VKEY_OEM_6; // case ']': case '}': return 0xDD;
389 // VKEY_OEM_7 (DE) Used for miscellaneous characters; it can vary by key board. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-q uote' key
390 case GDK_quoteright:
391 case GDK_quotedbl:
392 return VKEY_OEM_7; // case '\'': case '"': return 0xDE;
393 // VKEY_OEM_8 (DF) Used for miscellaneous characters; it can vary by key board.
394 // VKEY_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or th e backslash key on the RT 102-key keyboard
395 // VKEY_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/X P: IME PROCESS key
396 // VKEY_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VKEY_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP
397 // VKEY_ATTN (F6) Attn key
398 // VKEY_CRSEL (F7) CrSel key
399 // VKEY_EXSEL (F8) ExSel key
400 // VKEY_EREOF (F9) Erase EOF key
401 // VKEY_PLAY (FA) Play key
402 // VKEY_ZOOM (FB) Zoom key
403 // VKEY_NONAME (FC) Reserved for future use
404 // VKEY_PA1 (FD) PA1 key
405 // VKEY_OEM_CLEAR (FE) Clear key
406 case GDK_F1:
407 case GDK_F2:
408 case GDK_F3:
409 case GDK_F4:
410 case GDK_F5:
411 case GDK_F6:
412 case GDK_F7:
413 case GDK_F8:
414 case GDK_F9:
415 case GDK_F10:
416 case GDK_F11:
417 case GDK_F12:
418 case GDK_F13:
419 case GDK_F14:
420 case GDK_F15:
421 case GDK_F16:
422 case GDK_F17:
423 case GDK_F18:
424 case GDK_F19:
425 case GDK_F20:
426 case GDK_F21:
427 case GDK_F22:
428 case GDK_F23:
429 case GDK_F24:
430 return VKEY_F1 + (keycode - GDK_F1);
431 default:
432 return 0;
433 }
434 }
435
436 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/platform/chromium/KeyCodeConversionAndroid.cpp ('k') | Source/platform/KeyCodeConversion.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698