| Summary: | [patch] Win32: reset deadkeys in StartTextInput/StopTextInput | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Eric Wasylishen <ewasylishen> |
| Component: | events | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | sezeroz |
| Version: | HG 2.1 | ||
| Hardware: | x86_64 | ||
| OS: | Windows (All) | ||
| Attachments: |
patch to test program to demonstrate the bug
proposed fix patch for SDL 1.2 Updated sdl2 patch Updated sdl1.2 patch |
||
Created attachment 2452 [details]
proposed fix
Created attachment 2462 [details]
patch for SDL 1.2
Created attachment 2463 [details]
Updated sdl2 patch
Updated SDL2 patch from Ozkan:
-make C89
-call WIN_ResetDeadKeys() from SDL_KeyboardQuit so dead keys pressed just before exiting don't carry over to other applications
Created attachment 2464 [details]
Updated sdl1.2 patch
Updated SDL1.2 patch from Ozkan, same changes as for SDL2
Fixed, thanks! I used a slightly different way of resetting dead keys on exit that also covers alt-tab away from the SDL window. https://hg.libsdl.org/SDL/rev/e9dd9ecf3fe5 https://hg.libsdl.org/SDL/rev/9012ec687429 |
Created attachment 2451 [details] patch to test program to demonstrate the bug The bug here is that a dead keys pressed before calling SDL_StartTextInput() carries over into future text input, so the next key pressed will have the deadkey applied to it. This in undesirable, imho, and doesn't occur on OS X (haven't check Linux or elsewhere). It's causing a problem for Quakespasm on German keyboard layouts, where we use the ^ deadkey to toggle the console (which enables/disables text input), and ^ characters are showing up in the TEXTINPUT events. Attaching a patch. Unfortunately there's no clean API to reset the dead key state, the only way appears to be using ToUnicode. Also attached a patch to the checkkeys sample so you can reproduce this; it makes clicking the mouse toggle SDL_StartTextInput() and SDL_StopTextInput(). Steps to reproduce with the patched 'checkkeys': 1. switch to a keyboard layout with deadkeys, e.g. German 2. launch "checkkeys", click the mouse to disable text input 3. press the a deadkey, e.g. ^ below Escape on the German layout 4. click the mouse again to cause a SDL_StartTextInput() call 5. press "a" key. expected: the TEXTINPUT event in the log should just be a regular "a" observed: the "a" has an accent