diff -r d3db276c1fa6 src/video/windows/SDL_windowskeyboard.c --- a/src/video/windows/SDL_windowskeyboard.c Tue May 10 21:15:11 2016 +0200 +++ b/src/video/windows/SDL_windowskeyboard.c Tue May 10 23:14:15 2016 -0700 @@ -158,8 +158,44 @@ } void +WIN_ResetDeadKeys() +{ + /* + if a deadkey has been typed, but not the next character (which the deadkey might modify), + this tries to undo the effect pressing the deadkey. + see: http://archives.miloush.net/michkap/archive/2006/09/10/748775.html + */ + + BYTE keyboardState[256]; + WCHAR buffer[16]; + int keycode, scancode, result, i; + + GetKeyboardState(keyboardState); + + keycode = VK_SPACE; + scancode = MapVirtualKey(keycode, MAPVK_VK_TO_VSC); + if (scancode == 0) + { + /* the keyboard doesn't have this key */ + return; + } + + for (i = 0; i < 5; i++) + { + result = ToUnicode(keycode, scancode, keyboardState, (LPWSTR)buffer, 16, 0); + if (result > 0) + { + /* success */ + return; + } + } +} + +void WIN_StartTextInput(_THIS) { + WIN_ResetDeadKeys(); + #ifndef SDL_DISABLE_WINDOWS_IME SDL_Window *window = SDL_GetKeyboardFocus(); if (window) { @@ -175,6 +211,8 @@ void WIN_StopTextInput(_THIS) { + WIN_ResetDeadKeys(); + #ifndef SDL_DISABLE_WINDOWS_IME SDL_Window *window = SDL_GetKeyboardFocus(); if (window) {