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

SDL_TEXTINPUT system doesn't handle key sequences correctly on Windows #1409

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

Comments

@SDLBugzilla
Copy link
Collaborator

SDLBugzilla commented Feb 10, 2021

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: 2.0.3
Reported for operating system, platform: Windows 8, x86

Comments on the original bug report:

On 2014-03-19 21:13:01 +0000, wrote:

SDL_TEXTINPUT system doesn't handle key sequences correctly on Windows due to the usage of both TranslateMessage and ToUnicode to handle WM_KEY* messages.

In my keyboard layout, pressing single quote character ('), followed by certain letters (acegksu..) outputs language-specific variations of those letters (āčēģķšū..). This is the software I use that provides this layout: http://laacz.lv/f/misc/apos/apostrofs-punkts.zip - it can be used to verify the bug and check if it's been fixed.

From what I've seen while experimenting with this code - https://www.dropbox.com/s/ydkrms6zgaxueb8/winchar.c - it works if either TranslateMessage is called or ToUnicode(Ex) is called, but not both.

Quote from http://msdn.microsoft.com/en-us/library/windows/desktop/ms646322(v=vs.85).aspx (ToUnicodeEx page):

As ToUnicodeEx translates the virtual-key code, it also changes the state of the kernel-mode keyboard buffer. This state-change affects dead keys, ligatures, alt+numpad key entry, and so on. It might also cause undesired side-effects if used in conjunction with TranslateMessage (which also changes the state of the kernel-mode keyboard buffer).

So far the solution seems simple. However, it appears there must be a reason for why WM_CHAR messages are not used. The reason for TranslateMessage was given in comments: compatibility with other systems.

For my use case (https://github.com/snake5/sgs-sdl) it would be completely acceptable to include an optional solution in the form of an API function that disables either function call to make it work. For compatibility with other systems, possibly the usage of WM_KEYDOWN/ToUnicode instead of WM_CHAR/TranslateMessage should be reconsidered.

On 2014-03-19 21:29:43 +0000, wrote:

Created attachment 1596
test kit for the bug

On 2016-08-30 17:44:36 +0000, wrote:

I just checked 2.0.4 and the bug appears to be fixed there.

P.S. The development archive in the download page (https://www.libsdl.org/release/SDL2-devel-2.0.4-mingw.tar.gz) contains 2.0.2 in root folder and 2.0.4 under i686-w64-mingw32/x86_64-w64-mingw32.

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