• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 /*
6  * Copyright (C) 2006, 2007 Apple Inc.  All rights reserved.
7  * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
8  * Copyright (C) 2007 Holger Hans Peter Freyther
9  * Copyright (C) 2008 Collabora, Ltd.  All rights reserved.
10  * Copyright (C) 2008, 2009 Google Inc.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  *
21  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
22  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
25  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
29  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 // WindowsKeyCodeForGdkKeyCode is copied from platform/gtk/KeyEventGtk.cpp
35 
36 #ifndef BASE_KEYBOARD_CODE_CONVERSION_GTK_H_
37 #define BASE_KEYBOARD_CODE_CONVERSION_GTK_H_
38 
39 #include "base/keyboard_code_conversion_gtk.h"
40 
41 #include <gdk/gdkkeysyms.h>
42 
43 #include "base/keyboard_codes_posix.h"
44 
45 namespace base {
46 
WindowsKeyCodeForGdkKeyCode(int keycode)47 base::KeyboardCode WindowsKeyCodeForGdkKeyCode(int keycode) {
48   switch (keycode) {
49     case GDK_KP_0:
50       return VKEY_NUMPAD0;  // (60) Numeric keypad 0 key
51     case GDK_KP_1:
52       return VKEY_NUMPAD1;  // (61) Numeric keypad 1 key
53     case GDK_KP_2:
54       return  VKEY_NUMPAD2;  // (62) Numeric keypad 2 key
55     case GDK_KP_3:
56       return VKEY_NUMPAD3;  // (63) Numeric keypad 3 key
57     case GDK_KP_4:
58       return VKEY_NUMPAD4;  // (64) Numeric keypad 4 key
59     case GDK_KP_5:
60       return VKEY_NUMPAD5;  // (65) Numeric keypad 5 key
61     case GDK_KP_6:
62       return VKEY_NUMPAD6;  // (66) Numeric keypad 6 key
63     case GDK_KP_7:
64       return VKEY_NUMPAD7;  // (67) Numeric keypad 7 key
65     case GDK_KP_8:
66       return VKEY_NUMPAD8;  // (68) Numeric keypad 8 key
67     case GDK_KP_9:
68       return VKEY_NUMPAD9;  // (69) Numeric keypad 9 key
69     case GDK_KP_Multiply:
70       return VKEY_MULTIPLY;  // (6A) Multiply key
71     case GDK_KP_Add:
72       return VKEY_ADD;  // (6B) Add key
73     case GDK_KP_Subtract:
74       return VKEY_SUBTRACT; // (6D) Subtract key
75     case GDK_KP_Decimal:
76       return VKEY_DECIMAL; // (6E) Decimal key
77     case GDK_KP_Divide:
78       return VKEY_DIVIDE; // (6F) Divide key
79 
80     case GDK_BackSpace:
81       return VKEY_BACK;  // (08) BACKSPACE key
82     case GDK_ISO_Left_Tab:
83     case GDK_3270_BackTab:
84     case GDK_Tab:
85       return VKEY_TAB;  // (09) TAB key
86     case GDK_Clear:
87       return VKEY_CLEAR;  // (0C) CLEAR key
88     case GDK_ISO_Enter:
89     case GDK_KP_Enter:
90     case GDK_Return:
91       return VKEY_RETURN;  // (0D) Return key
92     case GDK_Shift_L:
93     case GDK_Shift_R:
94       return VKEY_SHIFT;  // (10) SHIFT key
95     case GDK_Control_L:
96     case GDK_Control_R:
97       return VKEY_CONTROL;  // (11) CTRL key
98     case GDK_Menu:
99     case GDK_Alt_L:
100     case GDK_Alt_R:
101       return VKEY_MENU;  // (12) ALT key
102 
103     case GDK_Pause:
104       return VKEY_PAUSE;  // (13) PAUSE key
105     case GDK_Caps_Lock:
106       return VKEY_CAPITAL;  // (14) CAPS LOCK key
107     case GDK_Kana_Lock:
108     case GDK_Kana_Shift:
109       return VKEY_KANA;  // (15) Input Method Editor (IME) Kana mode
110     case GDK_Hangul:
111       return VKEY_HANGUL;  // VKEY_HANGUL (15) IME Hangul mode
112       // VKEY_JUNJA (17) IME Junja mode
113       // VKEY_FINAL (18) IME final mode
114     case GDK_Hangul_Hanja:
115       return VKEY_HANJA;  // (19) IME Hanja mode
116     case GDK_Kanji:
117       return VKEY_KANJI;  // (19) IME Kanji mode
118     case GDK_Escape:
119       return VKEY_ESCAPE;  // (1B) ESC key
120       // VKEY_CONVERT (1C) IME convert
121       // VKEY_NONCONVERT (1D) IME nonconvert
122       // VKEY_ACCEPT (1E) IME accept
123       // VKEY_MODECHANGE (1F) IME mode change request
124     case GDK_space:
125       return VKEY_SPACE;  // (20) SPACEBAR
126     case GDK_Page_Up:
127       return VKEY_PRIOR;  // (21) PAGE UP key
128     case GDK_Page_Down:
129       return VKEY_NEXT;  // (22) PAGE DOWN key
130     case GDK_End:
131       return VKEY_END;  // (23) END key
132     case GDK_Home:
133       return VKEY_HOME;  // (24) HOME key
134     case GDK_Left:
135       return VKEY_LEFT;  // (25) LEFT ARROW key
136     case GDK_Up:
137       return VKEY_UP;  // (26) UP ARROW key
138     case GDK_Right:
139       return VKEY_RIGHT;  // (27) RIGHT ARROW key
140     case GDK_Down:
141       return VKEY_DOWN;  // (28) DOWN ARROW key
142     case GDK_Select:
143       return VKEY_SELECT;  // (29) SELECT key
144     case GDK_Print:
145       return VKEY_PRINT;  // (2A) PRINT key
146     case GDK_Execute:
147       return VKEY_EXECUTE;  // (2B) EXECUTE key
148       // dunno on this
149       // case GDK_PrintScreen:
150       //      return VKEY_SNAPSHOT; // (2C) PRINT SCREEN key
151     case GDK_Insert:
152       return VKEY_INSERT;  // (2D) INS key
153     case GDK_Delete:
154       return VKEY_DELETE;  // (2E) DEL key
155     case GDK_Help:
156       return VKEY_HELP;  // (2F) HELP key
157     case GDK_0:
158     case GDK_parenright:
159       return VKEY_0;  // (30) 0) key
160     case GDK_1:
161     case GDK_exclam:
162       return VKEY_1;  // (31) 1 ! key
163     case GDK_2:
164     case GDK_at:
165       return VKEY_2;  // (32) 2 & key
166     case GDK_3:
167     case GDK_numbersign:
168       return VKEY_3;  // case '3': case '#';
169     case GDK_4:
170     case GDK_dollar:  // (34) 4 key '$';
171       return VKEY_4;
172     case GDK_5:
173     case GDK_percent:
174       return VKEY_5;  // (35) 5 key  '%'
175     case GDK_6:
176     case GDK_asciicircum:
177       return VKEY_6;  // (36) 6 key  '^'
178     case GDK_7:
179     case GDK_ampersand:
180       return VKEY_7;  // (37) 7 key  case '&'
181     case GDK_8:
182     case GDK_asterisk:
183       return VKEY_8;  // (38) 8 key  '*'
184     case GDK_9:
185     case GDK_parenleft:
186       return VKEY_9;  // (39) 9 key '('
187     case GDK_a:
188     case GDK_A:
189       return VKEY_A;  // (41) A key case 'a': case 'A': return 0x41;
190     case GDK_b:
191     case GDK_B:
192       return VKEY_B;  // (42) B key case 'b': case 'B': return 0x42;
193     case GDK_c:
194     case GDK_C:
195       return VKEY_C;  // (43) C key case 'c': case 'C': return 0x43;
196     case GDK_d:
197     case GDK_D:
198       return VKEY_D;  // (44) D key case 'd': case 'D': return 0x44;
199     case GDK_e:
200     case GDK_E:
201       return VKEY_E;  // (45) E key case 'e': case 'E': return 0x45;
202     case GDK_f:
203     case GDK_F:
204       return VKEY_F;  // (46) F key case 'f': case 'F': return 0x46;
205     case GDK_g:
206     case GDK_G:
207       return VKEY_G;  // (47) G key case 'g': case 'G': return 0x47;
208     case GDK_h:
209     case GDK_H:
210       return VKEY_H;  // (48) H key case 'h': case 'H': return 0x48;
211     case GDK_i:
212     case GDK_I:
213       return VKEY_I;  // (49) I key case 'i': case 'I': return 0x49;
214     case GDK_j:
215     case GDK_J:
216       return VKEY_J;  // (4A) J key case 'j': case 'J': return 0x4A;
217     case GDK_k:
218     case GDK_K:
219       return VKEY_K;  // (4B) K key case 'k': case 'K': return 0x4B;
220     case GDK_l:
221     case GDK_L:
222       return VKEY_L;  // (4C) L key case 'l': case 'L': return 0x4C;
223     case GDK_m:
224     case GDK_M:
225       return VKEY_M;  // (4D) M key case 'm': case 'M': return 0x4D;
226     case GDK_n:
227     case GDK_N:
228       return VKEY_N;  // (4E) N key case 'n': case 'N': return 0x4E;
229     case GDK_o:
230     case GDK_O:
231       return VKEY_O;  // (4F) O key case 'o': case 'O': return 0x4F;
232     case GDK_p:
233     case GDK_P:
234       return VKEY_P;  // (50) P key case 'p': case 'P': return 0x50;
235     case GDK_q:
236     case GDK_Q:
237       return VKEY_Q;  // (51) Q key case 'q': case 'Q': return 0x51;
238     case GDK_r:
239     case GDK_R:
240       return VKEY_R;  // (52) R key case 'r': case 'R': return 0x52;
241     case GDK_s:
242     case GDK_S:
243       return VKEY_S;  // (53) S key case 's': case 'S': return 0x53;
244     case GDK_t:
245     case GDK_T:
246       return VKEY_T;  // (54) T key case 't': case 'T': return 0x54;
247     case GDK_u:
248     case GDK_U:
249       return VKEY_U;  // (55) U key case 'u': case 'U': return 0x55;
250     case GDK_v:
251     case GDK_V:
252       return VKEY_V;  // (56) V key case 'v': case 'V': return 0x56;
253     case GDK_w:
254     case GDK_W:
255       return VKEY_W;  // (57) W key case 'w': case 'W': return 0x57;
256     case GDK_x:
257     case GDK_X:
258       return VKEY_X;  // (58) X key case 'x': case 'X': return 0x58;
259     case GDK_y:
260     case GDK_Y:
261       return VKEY_Y;  // (59) Y key case 'y': case 'Y': return 0x59;
262     case GDK_z:
263     case GDK_Z:
264       return VKEY_Z;  // (5A) Z key case 'z': case 'Z': return 0x5A;
265     case GDK_Meta_L:
266       return VKEY_LWIN; // (5B) Left Windows key (Microsoft Natural keyboard)
267     case GDK_Meta_R:
268       return VKEY_RWIN; // (5C) Right Windows key (Natural keyboard)
269       // VKEY_APPS (5D) Applications key (Natural keyboard)
270       // VKEY_SLEEP (5F) Computer Sleep key
271       // VKEY_SEPARATOR (6C) Separator key
272       // VKEY_SUBTRACT (6D) Subtract key
273       // VKEY_DECIMAL (6E) Decimal key
274       // VKEY_DIVIDE (6F) Divide key
275       // handled by key code above
276 
277     case GDK_Num_Lock:
278       return VKEY_NUMLOCK;  // (90) NUM LOCK key
279 
280     case GDK_Scroll_Lock:
281       return VKEY_SCROLL;  // (91) SCROLL LOCK key
282 
283       // VKEY_LSHIFT (A0) Left SHIFT key
284       // VKEY_RSHIFT (A1) Right SHIFT key
285       // VKEY_LCONTROL (A2) Left CONTROL key
286       // VKEY_RCONTROL (A3) Right CONTROL key
287       // VKEY_LMENU (A4) Left MENU key
288       // VKEY_RMENU (A5) Right MENU key
289       // VKEY_BROWSER_BACK (A6) Windows 2000/XP: Browser Back key
290       // VKEY_BROWSER_FORWARD (A7) Windows 2000/XP: Browser Forward key
291       // VKEY_BROWSER_REFRESH (A8) Windows 2000/XP: Browser Refresh key
292       // VKEY_BROWSER_STOP (A9) Windows 2000/XP: Browser Stop key
293       // VKEY_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key
294       // VKEY_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key
295       // VKEY_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key
296       // VKEY_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key
297       // VKEY_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key
298       // VKEY_VOLUME_UP (AF) Windows 2000/XP: Volume Up key
299       // VKEY_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key
300       // VKEY_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key
301       // VKEY_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key
302       // VKEY_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key
303       // VKEY_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key
304       // VKEY_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key
305       // VKEY_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key
306       // VKEY_LAUNCH_APP2 (B7) Windows 2000/XP: Start Application 2 key
307 
308       // VKEY_OEM_1 (BA) Used for miscellaneous characters; it can vary by
309       // keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key
310     case GDK_semicolon:
311     case GDK_colon:
312       return VKEY_OEM_1;  // case ';': case ':': return 0xBA;
313       // VKEY_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key
314     case GDK_plus:
315     case GDK_equal:
316       return VKEY_OEM_PLUS;  // case '=': case '+': return 0xBB;
317       // VKEY_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ','
318       // key
319     case GDK_comma:
320     case GDK_less:
321       return VKEY_OEM_COMMA;  // case ',': case '<': return 0xBC;
322       // VKEY_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-'
323       // key
324     case GDK_minus:
325     case GDK_underscore:
326       return VKEY_OEM_MINUS;  // case '-': case '_': return 0xBD;
327       // VKEY_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.'
328       // key
329     case GDK_period:
330     case GDK_greater:
331       return VKEY_OEM_PERIOD;  // case '.': case '>': return 0xBE;
332       // VKEY_OEM_2 (BF) Used for miscellaneous characters; it can vary by
333       // keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key
334     case GDK_slash:
335     case GDK_question:
336       return VKEY_OEM_2;  // case '/': case '?': return 0xBF;
337       // VKEY_OEM_3 (C0) Used for miscellaneous characters; it can vary by
338       // keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key
339     case GDK_asciitilde:
340     case GDK_quoteleft:
341       return VKEY_OEM_3;  // case '`': case '~': return 0xC0;
342       // VKEY_OEM_4 (DB) Used for miscellaneous characters; it can vary by
343       // keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key
344     case GDK_bracketleft:
345     case GDK_braceleft:
346       return VKEY_OEM_4;  // case '[': case '{': return 0xDB;
347       // VKEY_OEM_5 (DC) Used for miscellaneous characters; it can vary by
348       // keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key
349     case GDK_backslash:
350     case GDK_bar:
351       return VKEY_OEM_5;  // case '\\': case '|': return 0xDC;
352       // VKEY_OEM_6 (DD) Used for miscellaneous characters; it can vary by
353       // keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key
354     case GDK_bracketright:
355     case GDK_braceright:
356       return VKEY_OEM_6;  // case ']': case '}': return 0xDD;
357       // VKEY_OEM_7 (DE) Used for miscellaneous characters; it can vary by
358       // keyboard. Windows 2000/XP: For the US standard keyboard, the
359       // 'single-quote/double-quote' key
360     case GDK_quoteright:
361     case GDK_quotedbl:
362       return VKEY_OEM_7;  // case '\'': case '"': return 0xDE;
363       // VKEY_OEM_8 (DF) Used for miscellaneous characters; it can vary by
364       // keyboard.
365       // VKEY_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the
366       // backslash key on the RT 102-key keyboard
367       // VKEY_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP:
368       // IME PROCESS key
369       // VKEY_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if
370       // they were keystrokes. The VKEY_PACKET key is the low word of a 32-bit
371       // Virtual Key value used for non-keyboard input methods. For more
372       // information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and
373       // WM_KEYUP
374       // VKEY_ATTN (F6) Attn key
375       // VKEY_CRSEL (F7) CrSel key
376       // VKEY_EXSEL (F8) ExSel key
377       // VKEY_EREOF (F9) Erase EOF key
378       // VKEY_PLAY (FA) Play key
379       // VKEY_ZOOM (FB) Zoom key
380       // VKEY_NONAME (FC) Reserved for future use
381       // VKEY_PA1 (FD) PA1 key
382       // VKEY_OEM_CLEAR (FE) Clear key
383     case GDK_F1:
384     case GDK_F2:
385     case GDK_F3:
386     case GDK_F4:
387     case GDK_F5:
388     case GDK_F6:
389     case GDK_F7:
390     case GDK_F8:
391     case GDK_F9:
392     case GDK_F10:
393     case GDK_F11:
394     case GDK_F12:
395     case GDK_F13:
396     case GDK_F14:
397     case GDK_F15:
398     case GDK_F16:
399     case GDK_F17:
400     case GDK_F18:
401     case GDK_F19:
402     case GDK_F20:
403     case GDK_F21:
404     case GDK_F22:
405     case GDK_F23:
406     case GDK_F24:
407       return static_cast<base::KeyboardCode>(VKEY_F1 + (keycode - GDK_F1));
408     default:
409       return VKEY_UNKNOWN;
410     }
411 }
412 
413 // TODO(jcampan): this method might be incomplete.
GdkKeyCodeForWindowsKeyCode(base::KeyboardCode keycode,bool shift)414 int GdkKeyCodeForWindowsKeyCode(base::KeyboardCode keycode, bool shift) {
415   switch (keycode) {
416     case VKEY_NUMPAD0:
417       return GDK_KP_0;
418     case VKEY_NUMPAD1:
419       return GDK_KP_1;
420     case VKEY_NUMPAD2:
421       return GDK_KP_2;
422     case VKEY_NUMPAD3:
423       return GDK_KP_3;
424     case VKEY_NUMPAD4:
425       return GDK_KP_4;
426     case VKEY_NUMPAD5:
427       return GDK_KP_5;
428     case VKEY_NUMPAD6:
429       return GDK_KP_6;
430     case VKEY_NUMPAD7:
431       return GDK_KP_7;
432     case VKEY_NUMPAD8:
433       return GDK_KP_8;
434     case VKEY_NUMPAD9:
435       return GDK_KP_9;
436     case VKEY_MULTIPLY:
437       return GDK_KP_Multiply;
438     case VKEY_ADD:
439       return GDK_KP_Add;
440     case VKEY_SUBTRACT:
441       return GDK_KP_Subtract;
442     case VKEY_DECIMAL:
443       return GDK_KP_Decimal;
444     case VKEY_DIVIDE:
445       return GDK_KP_Divide;
446 
447     case VKEY_BACK:
448       return GDK_BackSpace;
449     case VKEY_TAB:
450       return shift ? GDK_ISO_Left_Tab : GDK_Tab;
451     case VKEY_CLEAR:
452       return GDK_Clear;
453     case VKEY_RETURN:
454       return GDK_Return;
455     case VKEY_SHIFT:
456       return GDK_Shift_L;
457     case VKEY_CONTROL:
458       return GDK_Control_L;
459     case VKEY_MENU:
460       return GDK_Menu;
461 
462     case VKEY_PAUSE:
463       return GDK_Pause;
464     case VKEY_CAPITAL:
465       return GDK_Caps_Lock;
466     case VKEY_KANA:
467       return GDK_Kana_Lock;
468     case VKEY_HANJA:
469       return GDK_Hangul_Hanja;
470     case VKEY_ESCAPE:
471       return GDK_Escape;
472     case VKEY_SPACE:
473       return GDK_space;
474     case VKEY_PRIOR:
475       return GDK_Page_Up;
476     case VKEY_NEXT:
477       return GDK_Page_Down;
478     case VKEY_END:
479       return GDK_End;
480     case VKEY_HOME:
481       return GDK_Home;
482     case VKEY_LEFT:
483       return GDK_Left;
484     case VKEY_UP:
485       return GDK_Up;
486     case VKEY_RIGHT:
487       return GDK_Right;
488     case VKEY_DOWN:
489       return GDK_Down;
490     case VKEY_SELECT:
491       return GDK_Select;
492     case VKEY_PRINT:
493       return GDK_Print;
494     case VKEY_EXECUTE:
495       return GDK_Execute;
496     case VKEY_INSERT:
497       return GDK_Insert;
498     case VKEY_DELETE:
499       return GDK_Delete;
500     case VKEY_HELP:
501       return GDK_Help;
502     case VKEY_0:
503       return shift ? GDK_parenright : GDK_0;
504     case VKEY_1:
505       return shift ? GDK_exclam : GDK_1;
506     case VKEY_2:
507       return shift ? GDK_at : GDK_2;
508     case VKEY_3:
509       return shift ? GDK_numbersign : GDK_3;
510     case VKEY_4:
511       return shift ? GDK_dollar : GDK_4;
512     case VKEY_5:
513       return shift ? GDK_percent : GDK_5;
514     case VKEY_6:
515       return shift ? GDK_asciicircum : GDK_6;
516     case VKEY_7:
517       return shift ? GDK_ampersand : GDK_7;
518     case VKEY_8:
519       return shift ? GDK_asterisk : GDK_8;
520     case VKEY_9:
521       return shift ? GDK_parenleft : GDK_9;
522 
523     case VKEY_A:
524     case VKEY_B:
525     case VKEY_C:
526     case VKEY_D:
527     case VKEY_E:
528     case VKEY_F:
529     case VKEY_G:
530     case VKEY_H:
531     case VKEY_I:
532     case VKEY_J:
533     case VKEY_K:
534     case VKEY_L:
535     case VKEY_M:
536     case VKEY_N:
537     case VKEY_O:
538     case VKEY_P:
539     case VKEY_Q:
540     case VKEY_R:
541     case VKEY_S:
542     case VKEY_T:
543     case VKEY_U:
544     case VKEY_V:
545     case VKEY_W:
546     case VKEY_X:
547     case VKEY_Y:
548     case VKEY_Z:
549       return (shift ? GDK_A : GDK_a) + (keycode - VKEY_A);
550 
551     case VKEY_LWIN:
552       return GDK_Meta_L;
553     case VKEY_RWIN:
554       return GDK_Meta_R;
555 
556     case VKEY_NUMLOCK:
557       return GDK_Num_Lock;
558 
559     case VKEY_SCROLL:
560       return GDK_Scroll_Lock;
561 
562     case VKEY_OEM_1:
563       return shift ? GDK_colon : GDK_semicolon;
564     case VKEY_OEM_PLUS:
565       return shift ? GDK_plus : GDK_equal;
566     case VKEY_OEM_COMMA:
567       return shift ? GDK_less : GDK_comma;
568     case VKEY_OEM_MINUS:
569       return shift ? GDK_underscore : GDK_minus;
570     case VKEY_OEM_PERIOD:
571       return shift ? GDK_greater : GDK_period;
572     case VKEY_OEM_2:
573       return shift ? GDK_question : GDK_slash;
574     case VKEY_OEM_3:
575       return shift ? GDK_asciitilde : GDK_quoteleft;
576     case VKEY_OEM_4:
577       return shift ? GDK_braceleft : GDK_bracketleft;
578     case VKEY_OEM_5:
579       return shift ? GDK_bar : GDK_backslash;
580     case VKEY_OEM_6:
581       return shift ? GDK_braceright : GDK_bracketright;
582     case VKEY_OEM_7:
583       return shift ? GDK_quotedbl : GDK_quoteright;
584 
585     case VKEY_F1:
586     case VKEY_F2:
587     case VKEY_F3:
588     case VKEY_F4:
589     case VKEY_F5:
590     case VKEY_F6:
591     case VKEY_F7:
592     case VKEY_F8:
593     case VKEY_F9:
594     case VKEY_F10:
595     case VKEY_F11:
596     case VKEY_F12:
597     case VKEY_F13:
598     case VKEY_F14:
599     case VKEY_F15:
600     case VKEY_F16:
601     case VKEY_F17:
602     case VKEY_F18:
603     case VKEY_F19:
604     case VKEY_F20:
605     case VKEY_F21:
606     case VKEY_F22:
607     case VKEY_F23:
608     case VKEY_F24:
609       return GDK_F1 + (keycode - VKEY_F1);
610 
611     default:
612       return 0;
613     }
614 }
615 
616 } // namespace
617 
618 #endif  // BASE_KEYBOARD_CODE_CONVERSION_GTK_H_
619