src/video/windib/SDL_dibevents.c
branchSDL-1.2
changeset 4170 092c0bc69155
parent 4167 a6f635e5eaa6
child 4179 d7294b7c732d
     1.1 --- a/src/video/windib/SDL_dibevents.c	Mon Apr 13 08:38:04 2009 +0000
     1.2 +++ b/src/video/windib/SDL_dibevents.c	Mon Apr 13 08:42:09 2009 +0000
     1.3 @@ -552,7 +552,13 @@
     1.4  		Uint16	wchars[2];
     1.5  
     1.6  		GetKeyboardState(keystate);
     1.7 -		if (SDL_ToUnicode((UINT)vkey, scancode, keystate, wchars, sizeof(wchars)/sizeof(wchars[0]), 0) == 1)
     1.8 +		/* Numlock isn't taken into account in ToUnicode,
     1.9 +		 * so we handle it as a special case here */
    1.10 +		if ((keystate[VK_NUMLOCK] & 1) && vkey >= VK_NUMPAD0 && vkey <= VK_NUMPAD9)
    1.11 +		{
    1.12 +			keysym->unicode = vkey - VK_NUMPAD0 + '0';
    1.13 +		}
    1.14 +		else if (SDL_ToUnicode((UINT)vkey, scancode, keystate, wchars, sizeof(wchars)/sizeof(wchars[0]), 0) > 0)
    1.15  		{
    1.16  			keysym->unicode = wchars[0];
    1.17  		}