src/video/windib/SDL_dibevents.c
changeset 1253 7c7ddaf195bf
parent 1251 86d0d01290ea
child 1264 f3a3f1890b91
     1.1 --- a/src/video/windib/SDL_dibevents.c	Thu Jan 19 08:53:12 2006 +0000
     1.2 +++ b/src/video/windib/SDL_dibevents.c	Thu Jan 19 09:09:32 2006 +0000
     1.3 @@ -281,6 +281,7 @@
     1.4  	VK_keymap[VK_EQUALS] = SDLK_EQUALS;
     1.5  	VK_keymap[VK_LBRACKET] = SDLK_LEFTBRACKET;
     1.6  	VK_keymap[VK_BACKSLASH] = SDLK_BACKSLASH;
     1.7 +	VK_keymap[VK_OEM_102] = SDLK_LESS;
     1.8  	VK_keymap[VK_RBRACKET] = SDLK_RIGHTBRACKET;
     1.9  	VK_keymap[VK_GRAVE] = SDLK_BACKQUOTE;
    1.10  	VK_keymap[VK_BACKTICK] = SDLK_BACKQUOTE;
    1.11 @@ -385,17 +386,18 @@
    1.12  	keysym->sym = VK_keymap[vkey];
    1.13  	keysym->mod = KMOD_NONE;
    1.14  	keysym->unicode = 0;
    1.15 -	if ( pressed && SDL_TranslateUNICODE ) { /* Someday use ToUnicode() */
    1.16 +	if ( pressed && SDL_TranslateUNICODE ) {
    1.17  #ifdef NO_GETKEYBOARDSTATE
    1.18  		/* Uh oh, better hope the vkey is close enough.. */
    1.19  		keysym->unicode = vkey;
    1.20  #else
    1.21 -		BYTE keystate[256];
    1.22 -		BYTE chars[2];
    1.23 +		BYTE	keystate[256];
    1.24 +		Uint16	wchars[2];
    1.25  
    1.26  		GetKeyboardState(keystate);
    1.27 -		if ( ToAscii(vkey,scancode,keystate,(WORD *)chars,0) == 1 ) {
    1.28 -			keysym->unicode = chars[0];
    1.29 +		if (SDL_ToUnicode(vkey, scancode, keystate, wchars, sizeof(wchars)/sizeof(wchars[0]), 0) == 1)
    1.30 +		{
    1.31 +			keysym->unicode = wchars[0];
    1.32  		}
    1.33  #endif /* NO_GETKEYBOARDSTATE */
    1.34  	}