Mercurial > sdl-ios-xcode
comparison src/video/windib/SDL_dibevents.c @ 1253:7c7ddaf195bf
Implemented ToUnicode() support on Windows 95/98/ME/NT/2000/XP
This is a collaborative effort between Alex Volkov and John Popplewell.
Thanks guys! (Fixes bug #39)
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 19 Jan 2006 09:09:32 +0000 |
parents | 86d0d01290ea |
children | f3a3f1890b91 |
comparison
equal
deleted
inserted
replaced
1252:57be1c741b8b | 1253:7c7ddaf195bf |
---|---|
279 VK_keymap[VK_9] = SDLK_9; | 279 VK_keymap[VK_9] = SDLK_9; |
280 VK_keymap[VK_SEMICOLON] = SDLK_SEMICOLON; | 280 VK_keymap[VK_SEMICOLON] = SDLK_SEMICOLON; |
281 VK_keymap[VK_EQUALS] = SDLK_EQUALS; | 281 VK_keymap[VK_EQUALS] = SDLK_EQUALS; |
282 VK_keymap[VK_LBRACKET] = SDLK_LEFTBRACKET; | 282 VK_keymap[VK_LBRACKET] = SDLK_LEFTBRACKET; |
283 VK_keymap[VK_BACKSLASH] = SDLK_BACKSLASH; | 283 VK_keymap[VK_BACKSLASH] = SDLK_BACKSLASH; |
284 VK_keymap[VK_OEM_102] = SDLK_LESS; | |
284 VK_keymap[VK_RBRACKET] = SDLK_RIGHTBRACKET; | 285 VK_keymap[VK_RBRACKET] = SDLK_RIGHTBRACKET; |
285 VK_keymap[VK_GRAVE] = SDLK_BACKQUOTE; | 286 VK_keymap[VK_GRAVE] = SDLK_BACKQUOTE; |
286 VK_keymap[VK_BACKTICK] = SDLK_BACKQUOTE; | 287 VK_keymap[VK_BACKTICK] = SDLK_BACKQUOTE; |
287 VK_keymap[VK_A] = SDLK_a; | 288 VK_keymap[VK_A] = SDLK_a; |
288 VK_keymap[VK_B] = SDLK_b; | 289 VK_keymap[VK_B] = SDLK_b; |
383 /* Set the keysym information */ | 384 /* Set the keysym information */ |
384 keysym->scancode = (unsigned char) scancode; | 385 keysym->scancode = (unsigned char) scancode; |
385 keysym->sym = VK_keymap[vkey]; | 386 keysym->sym = VK_keymap[vkey]; |
386 keysym->mod = KMOD_NONE; | 387 keysym->mod = KMOD_NONE; |
387 keysym->unicode = 0; | 388 keysym->unicode = 0; |
388 if ( pressed && SDL_TranslateUNICODE ) { /* Someday use ToUnicode() */ | 389 if ( pressed && SDL_TranslateUNICODE ) { |
389 #ifdef NO_GETKEYBOARDSTATE | 390 #ifdef NO_GETKEYBOARDSTATE |
390 /* Uh oh, better hope the vkey is close enough.. */ | 391 /* Uh oh, better hope the vkey is close enough.. */ |
391 keysym->unicode = vkey; | 392 keysym->unicode = vkey; |
392 #else | 393 #else |
393 BYTE keystate[256]; | 394 BYTE keystate[256]; |
394 BYTE chars[2]; | 395 Uint16 wchars[2]; |
395 | 396 |
396 GetKeyboardState(keystate); | 397 GetKeyboardState(keystate); |
397 if ( ToAscii(vkey,scancode,keystate,(WORD *)chars,0) == 1 ) { | 398 if (SDL_ToUnicode(vkey, scancode, keystate, wchars, sizeof(wchars)/sizeof(wchars[0]), 0) == 1) |
398 keysym->unicode = chars[0]; | 399 { |
400 keysym->unicode = wchars[0]; | |
399 } | 401 } |
400 #endif /* NO_GETKEYBOARDSTATE */ | 402 #endif /* NO_GETKEYBOARDSTATE */ |
401 } | 403 } |
402 return(keysym); | 404 return(keysym); |
403 } | 405 } |