Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[patch] Win32: reset deadkeys in StartTextInput/StopTextInput #2164

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Closed

[patch] Win32: reset deadkeys in StartTextInput/StopTextInput #2164

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 2.1
Reported for operating system, platform: Windows (All), x86_64

Comments on the original bug report:

On 2016-05-11 07:00:20 +0000, Eric Wasylishen wrote:

Created attachment 2451
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

On 2016-05-11 07:02:02 +0000, Eric Wasylishen wrote:

Created attachment 2452
proposed fix

On 2016-05-24 21:39:18 +0000, Eric Wasylishen wrote:

Created attachment 2462
patch for SDL 1.2

On 2016-05-25 22:32:27 +0000, Eric Wasylishen wrote:

Created attachment 2463
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

On 2016-05-25 22:33:28 +0000, Eric Wasylishen wrote:

Created attachment 2464
Updated sdl1.2 patch

Updated SDL1.2 patch from Ozkan, same changes as for SDL2

On 2016-10-01 19:19:08 +0000, Sam Lantinga wrote:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant