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