Mercurial > sdl-ios-xcode
comparison src/video/windx5/SDL_dx5events.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 | 040aa1bea9fc |
children | f61f045343d3 |
comparison
equal
deleted
inserted
replaced
1252:57be1c741b8b | 1253:7c7ddaf195bf |
---|---|
822 /* Set the keysym information */ | 822 /* Set the keysym information */ |
823 keysym->scancode = (unsigned char)scancode; | 823 keysym->scancode = (unsigned char)scancode; |
824 keysym->sym = DIK_keymap[scancode]; | 824 keysym->sym = DIK_keymap[scancode]; |
825 keysym->mod = KMOD_NONE; | 825 keysym->mod = KMOD_NONE; |
826 keysym->unicode = 0; | 826 keysym->unicode = 0; |
827 if ( pressed && SDL_TranslateUNICODE ) { /* Someday use ToUnicode() */ | 827 if ( pressed && SDL_TranslateUNICODE ) { |
828 UINT vkey; | 828 UINT vkey; |
829 #ifndef NO_GETKEYBOARDSTATE | 829 #ifndef NO_GETKEYBOARDSTATE |
830 BYTE keystate[256]; | 830 BYTE keystate[256]; |
831 BYTE chars[2]; | 831 Uint16 wchars[2]; |
832 #endif | 832 #endif |
833 | 833 |
834 vkey = MapVirtualKey(scancode, 1); | 834 vkey = MapVirtualKey(scancode, 1); |
835 #ifdef NO_GETKEYBOARDSTATE | 835 #ifdef NO_GETKEYBOARDSTATE |
836 /* Uh oh, better hope the vkey is close enough.. */ | 836 /* Uh oh, better hope the vkey is close enough.. */ |
837 keysym->unicode = vkey; | 837 keysym->unicode = vkey; |
838 #else | 838 #else |
839 GetKeyboardState(keystate); | 839 GetKeyboardState(keystate); |
840 if ( ToAscii(vkey,scancode,keystate,(WORD *)chars,0) == 1 ) { | 840 if (SDL_ToUnicode(vkey, scancode, keystate, wchars, sizeof(wchars)/sizeof(wchars[0]), 0) == 1) |
841 keysym->unicode = chars[0]; | 841 { |
842 } | 842 keysym->unicode = wchars[0]; |
843 #endif | 843 } |
844 #endif /* NO_GETKEYBOARDSTATE */ | |
844 } | 845 } |
845 return(keysym); | 846 return(keysym); |
846 } | 847 } |
847 | 848 |
848 int DX5_CreateWindow(_THIS) | 849 int DX5_CreateWindow(_THIS) |