Changeset 29655 in vbox for trunk/src/VBox
- Timestamp:
- May 18, 2010 9:38:28 PM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxSDL
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxSDL/Makefile.kmk
r28800 r29655 98 98 ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(KBUILD_TARGET)),) # X11 99 99 VBoxSDL_LIBS += \ 100 $(PATH_DLL)/VBoxKeyboard$(VBOX_SUFF_DLL) \ 100 101 $(VBOX_XCURSOR_LIBS) \ 101 102 X11 -
trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
r29542 r29655 34 34 35 35 #if defined(VBOXSDL_WITH_X11) 36 # include <VBox/VBoxKeyboard.h> 37 36 38 # include <X11/Xlib.h> 37 39 # include <X11/cursorfont.h> /* for XC_left_ptr */ … … 203 205 #ifdef VBOXSDL_WITH_X11 204 206 static Cursor gpDefaultOrigX11Cursor; 205 #ifdef RT_OS_LINUX206 static BOOL guseEvdevKeymap = FALSE;207 #endif208 207 #endif 209 208 static SDL_Cursor *gpCustomCursor = NULL; … … 665 664 " --hostkey <key> {<key2>} <mod> Set the host key to the values obtained using --detecthostkey\n" 666 665 " --termacpi Send an ACPI power button event when closing the window\n" 667 #if defined(RT_OS_LINUX)668 " --evdevkeymap Use evdev keycode map\n"669 #endif670 666 #ifdef VBOX_WITH_VRDP 671 667 " --vrdp <ports> Listen for VRDP connections on one of specified ports (default if not specified)\n" … … 1204 1200 } 1205 1201 } 1206 #if defined(RT_OS_LINUX) && defined(VBOXSDL_WITH_X11)1207 else if ( !strcmp(argv[curArg], "--evdevkeymap")1208 || !strcmp(argv[curArg], "-evdevkeymap"))1209 {1210 guseEvdevKeymap = TRUE;1211 }1212 #endif /* RT_OS_LINUX */1213 1202 #ifdef VBOX_WITH_VRDP 1214 1203 else if ( !strcmp(argv[curArg], "--vrdp") … … 2035 2024 } 2036 2025 # endif 2026 /* Initialise the keyboard */ 2027 X11DRV_InitKeyboard(gSdlInfo.info.x11.display, NULL, NULL, NULL); 2037 2028 # endif /* VBOXSDL_WITH_X11 */ 2038 2029 … … 3226 3217 return 0; 3227 3218 } 3228 // workaround for SDL keyboard translation issues on Linux3229 // keycodes > 0x100 are sent as 0xe0 keycode3230 // Note that these are the keycodes used by XFree86/X.org3231 // servers on a Linux host, and will almost certainly not3232 // work on other hosts or on other servers on Linux hosts.3233 // For a more general approach, see the Wine code in the GUI.3234 3235 3219 # else 3236 static const uint16_t x_keycode_to_pc_keycode[61] = 3237 { 3238 0x47|0x100, /* 97 Home */ 3239 0x48|0x100, /* 98 Up */ 3240 0x49|0x100, /* 99 PgUp */ 3241 0x4b|0x100, /* 100 Left */ 3242 0x4c, /* 101 KP-5 */ 3243 0x4d|0x100, /* 102 Right */ 3244 0x4f|0x100, /* 103 End */ 3245 0x50|0x100, /* 104 Down */ 3246 0x51|0x100, /* 105 PgDn */ 3247 0x52|0x100, /* 106 Ins */ 3248 0x53|0x100, /* 107 Del */ 3249 0x1c|0x100, /* 108 Enter */ 3250 0x1d|0x100, /* 109 Ctrl-R */ 3251 0x0, /* 110 Pause */ 3252 0x37|0x100, /* 111 Print */ 3253 0x35|0x100, /* 112 Divide */ 3254 0x38|0x100, /* 113 Alt-R */ 3255 0x46|0x100, /* 114 Break */ 3256 0x5b|0x100, /* 115 Win Left */ 3257 0x5c|0x100, /* 116 Win Right */ 3258 0x5d|0x100, /* 117 Win Menu */ 3259 0x0, /* 118 */ 3260 0x0, /* 119 */ 3261 0x0, /* 120 */ 3262 0xf1, /* 121 Korean Hangul to Latin?? */ 3263 0xf2, /* 122 Korean Hangul to Hanja?? */ 3264 0x0, /* 123 */ 3265 0x0, /* 124 */ 3266 0x0, /* 125 */ 3267 0x0, /* 126 */ 3268 0x0, /* 127 */ 3269 0x0, /* 128 */ 3270 0x79, /* 129 Japanese Henkan */ 3271 0x0, /* 130 */ 3272 0x7b, /* 131 Japanese Muhenkan */ 3273 0x0, /* 132 */ 3274 0x7d, /* 133 Japanese Yen */ 3275 0x7e, /* 134 Brazilian keypad */ 3276 0x0, /* 135 */ 3277 0x47, /* 136 KP_7 */ 3278 0x48, /* 137 KP_8 */ 3279 0x49, /* 138 KP_9 */ 3280 0x4b, /* 139 KP_4 */ 3281 0x4c, /* 140 KP_5 */ 3282 0x4d, /* 141 KP_6 */ 3283 0x4f, /* 142 KP_1 */ 3284 0x50, /* 143 KP_2 */ 3285 0x51, /* 144 KP_3 */ 3286 0x52, /* 145 KP_0 */ 3287 0x53, /* 146 KP_. */ 3288 0x47, /* 147 KP_HOME */ 3289 0x48, /* 148 KP_UP */ 3290 0x49, /* 149 KP_PgUp */ 3291 0x4b, /* 150 KP_Left */ 3292 0x4c, /* 151 KP_ */ 3293 0x4d, /* 152 KP_Right */ 3294 0x4f, /* 153 KP_End */ 3295 0x50, /* 154 KP_Down */ 3296 0x51, /* 155 KP_PgDn */ 3297 0x52, /* 156 KP_Ins */ 3298 0x53, /* 157 KP_Del */ 3299 }; 3300 3301 // workaround for SDL keyboard translation issues on EVDEV 3302 // keycodes > 0x100 are sent as 0xe0 keycode 3303 // these values are simply pulled from x_keycode_to_pc_keycode 3304 // not a whole lot of testing of the 'weird' values has taken 3305 // place (I don't own a Japanese or Korean keyboard) 3306 static const uint16_t evdev_keycode_to_pc_keycode[61] = 3307 { 3308 0x0, /* 97 EVDEV - RO ("Internet" Keyboards) */ 3309 0x0, /* 98 EVDEV - KATA (Katakana) */ 3310 0x0, /* 99 EVDEV - HIRA (Hiragana) */ 3311 0x79, /* 100 EVDEV - HENK (Henkan) */ 3312 0x70, /* 101 EVDEV - HKTG (Hiragana/Katakana toggle) */ 3313 0x7b, /* 102 EVDEV - MUHE (Muhenkan) */ 3314 0x0, /* 103 EVDEV - JPCM (KPJPComma) */ 3315 0x1c|0x100, /* 104 EVDEV - KPEN */ 3316 0x1d|0x100, /* 105 EVDEV - RCTL */ 3317 0x35|0x100, /* 106 EVDEV - KPDV */ 3318 0x37|0x100, /* 107 EVDEV - PRSC ***FIXME*** */ 3319 0x38|0x100, /* 108 EVDEV - RALT */ 3320 0x0, /* 109 EVDEV - LNFD ("Internet" Keyboards) */ 3321 0x47|0x100, /* 110 EVDEV - HOME ***FIXME*** */ 3322 0x48|0x100, /* 111 EVDEV - UP */ 3323 0x49|0x100, /* 112 EVDEV - PGUP */ 3324 0x4b|0x100, /* 113 EVDEV - LEFT */ 3325 0x4d|0x100, /* 114 EVDEV - RGHT */ 3326 0x4f|0x100, /* 115 EVDEV - END */ 3327 0x50|0x100, /* 116 EVDEV - DOWN */ 3328 0x51|0x100, /* 117 EVDEV - PGDN */ 3329 0x52|0x100, /* 118 EVDEV - INS */ 3330 0x53|0x100, /* 119 EVDEV - DELE */ 3331 0x0, /* 120 EVDEV - I120 ("Internet" Keyboards) */ 3332 //121-124 Solaris Compatibilty Stuff 3333 0x0, /* 121 EVDEV - MUTE */ 3334 0x0, /* 122 EVDEV - VOL- */ 3335 0x0, /* 123 EVDEV - VOL+ */ 3336 0x0, /* 124 EVDEV - POWR */ 3337 0x0, /* 125 EVDEV - KPEQ */ 3338 0x0, /* 126 EVDEV - I126 ("Internet" Keyboards) */ 3339 0x0, /* 127 EVDEV - PAUS */ 3340 0x0, /* 128 EVDEV - ???? */ 3341 0x0, /* 129 EVDEV - I129 ("Internet" Keyboards) */ 3342 0xf1, /* 130 EVDEV - HNGL (Korean Hangul Latin toggle) */ 3343 0xf2, /* 131 EVDEV - HJCV (Korean Hangul Hanja toggle) */ 3344 0x7d, /* 132 EVDEV - AE13 (Yen) */ 3345 0x5b|0x100, /* 133 EVDEV - LWIN */ 3346 0x5c|0x100, /* 134 EVDEV - RWIN */ 3347 0x5d|0x100, /* 135 EVDEV - MENU */ 3348 //136-146 Solaris Stuff 3349 0x0, /* 136 EVDEV - STOP */ 3350 0x0, /* 137 EVDEV - AGAI */ 3351 0x0, /* 138 EVDEV - PROP */ 3352 0x0, /* 139 EVDEV - UNDO */ 3353 0x0, /* 140 EVDEV - FRNT */ 3354 0x0, /* 141 EVDEV - COPY */ 3355 0x0, /* 142 EVDEV - OPEN */ 3356 0x0, /* 143 EVDEV - PAST */ 3357 0x0, /* 144 EVDEV - FIND */ 3358 0x0, /* 145 EVDEV - CUT */ 3359 0x0, /* 146 EVDEV - HELP */ 3360 //Extended Keys ("Internet" Keyboards) 3361 0x0, /* 147 EVDEV - I147 */ 3362 0x0, /* 148 EVDEV - I148 */ 3363 0x0, /* 149 EVDEV - I149 */ 3364 0x0, /* 150 EVDEV - I150 */ 3365 0x0, /* 151 EVDEV - I151 */ 3366 0x0, /* 152 EVDEV - I152 */ 3367 0x0, /* 153 EVDEV - I153 */ 3368 0x0, /* 154 EVDEV - I154 */ 3369 0x0, /* 155 EVDEV - I156 */ 3370 0x0, /* 156 EVDEV - I157 */ 3371 0x0, /* 157 EVDEV - I158 */ 3372 }; 3373 3374 if (keycode < 9) 3375 { 3376 keycode = 0; 3377 } 3378 else if (keycode < 97) 3379 { 3380 // just an offset (Xorg MIN_KEYCODE) 3381 keycode -= 8; 3382 } 3383 # ifdef RT_OS_LINUX 3384 else if (keycode < 158 && guseEvdevKeymap) 3385 { 3386 // apply EVDEV conversion table 3387 keycode = evdev_keycode_to_pc_keycode[keycode - 97]; 3388 } 3389 # endif 3390 else if (keycode < 158) 3391 { 3392 // apply conversion table 3393 keycode = x_keycode_to_pc_keycode[keycode - 97]; 3394 } 3395 else if (keycode == 208) 3396 { 3397 // Japanese Hiragana to Katakana 3398 keycode = 0x70; 3399 } 3400 else if (keycode == 211) 3401 { 3402 // Japanese backslash/underscore and Brazilian backslash/question mark 3403 keycode = 0x73; 3404 } 3405 else 3406 { 3407 keycode = 0; 3408 } 3220 keycode = X11DRV_KeyEvent(gSdlInfo.info.x11.display, keycode); 3409 3221 # endif 3410 3222 #elif defined(RT_OS_DARWIN)
Note:
See TracChangeset
for help on using the changeset viewer.