Index: src/video/windib/SDL_dibevents.c =================================================================== --- src/video/windib/SDL_dibevents.c (revision 4478) +++ src/video/windib/SDL_dibevents.c (working copy) @@ -552,8 +552,14 @@ Uint16 wchars[2]; GetKeyboardState(keystate); - if (SDL_ToUnicode((UINT)vkey, scancode, keystate, wchars, sizeof(wchars)/sizeof(wchars[0]), 0) == 1) + /* Numlock isn't taken into account in ToUnicode, + * so we handle it as a special case here */ + if ((keystate[VK_NUMLOCK] & 1) && vkey >= VK_NUMPAD0 && vkey <= VK_NUMPAD9) { + keysym->unicode = vkey - VK_NUMPAD0 + '0'; + } + else if (SDL_ToUnicode((UINT)vkey, scancode, keystate, wchars, sizeof(wchars)/sizeof(wchars[0]), 0) > 0) + { keysym->unicode = wchars[0]; } #endif /* NO_GETKEYBOARDSTATE */ Index: src/video/windx5/SDL_dx5events.c =================================================================== --- src/video/windx5/SDL_dx5events.c (revision 4478) +++ src/video/windx5/SDL_dx5events.c (working copy) @@ -912,8 +912,14 @@ keysym->unicode = vkey; #else GetKeyboardState(keystate); - if (SDL_ToUnicode(vkey, scancode, keystate, wchars, sizeof(wchars)/sizeof(wchars[0]), 0) == 1) + /* Numlock isn't taken into account in ToUnicode, + * so we handle it as a special case here */ + if ((keystate[VK_NUMLOCK] & 1) && vkey >= VK_NUMPAD0 && vkey <= VK_NUMPAD9) { + keysym->unicode = vkey - VK_NUMPAD0 + '0'; + } + else if (SDL_ToUnicode(vkey, scancode, keystate, wchars, sizeof(wchars)/sizeof(wchars[0]), 0) > 0) + { keysym->unicode = wchars[0]; } #endif /* NO_GETKEYBOARDSTATE */