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

Dead Keys don't generate events on X11 #1053

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

Dead Keys don't generate events on X11 #1053

SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

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: HG 2.0
Reported for operating system, platform: Linux, x86_64

Comments on the original bug report:

On 2013-08-28 21:37:03 +0000, Daniel Gibson wrote:

Created attachment 1310
Patch to generate SDL_KEYDOWN/UP events for dead keys

Pressing dead keys (e.g. ^ or `) on Linux/X11 doesn't generate SDL_KEYDOWN events, pressing another key afterwards (like for composition) just generates a "The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL mailing list sdl@libsdl.org X11 KeyCode 0 (-8), X11 KeySym 0x0 ((null))." message.

This is because XFilterEvent() (at the beginning of X11_DispatchEvent() in SDL_x11events.c) returns True for dead keys, so those events are discarded.
I also found out that XFilterEvents actually changes the events.
(Some more information can be found at http://forums.libsdl.org/viewtopic.php?p=38900# 38900 - note that for some reason the forum transformed "â" to "â")

I wrote a patch that in case of KeyPress/KeyRelease events saves the type and the KeyCode and, if XFilterEvent() decides to filter the event, calls SDL_SendKeyboardKey() accordingly.

This yields a similar behavior like SDL2 on Windows: There is a SDL_TEXTINPUT event with the composed char, but there are also two SDL_KEYDOWN events for the keys.

One small issue is that is that the SDL Keycode isn't the same as with the corresponding nodeadkey layout, but seems to be a direct translation of the Scancode.
E.g. on my (german) layout, The ^ key (below Esc) generates a SDL_SCANCODE_GRAVE (), but a ^ Keycode without dead keys. With dead keys enabled it generates the same Scancode, but a Keycode.
Probably X11 doesn't provide a proper mapping for that key because it's dead anyway, so the default is used.
I think that this is acceptable though and better than no key event at all (like it's the case right now).

On 2013-08-28 21:38:31 +0000, Daniel Gibson wrote:

Created attachment 1311
Small test-program that prints key events

On 2014-01-15 20:15:11 +0000, Daniel Gibson wrote:

A variant of this patch has been merged in the meantime: https://hg.libsdl.org/SDL/rev/713c6a333c33
So this can be closed.

On 2015-02-09 02:53:16 +0000, Daniel Gibson wrote:

This bug happens again in latest hg, because the fix was reverted as it caused https://bugzilla.libsdl.org/show_bug.cgi?id=2526

On 2015-12-31 05:01:21 +0000, Ryan C. Gordon wrote:

*** Bug 3076 has been marked as a duplicate of this bug. ***

On 2016-10-01 21:11:44 +0000, Sam Lantinga wrote:

Fixed by Alex's patch in bug 3136
https://hg.libsdl.org/SDL/rev/2f18ea79bc03

On 2016-10-01 21:11:53 +0000, Sam Lantinga wrote:

Fixed!

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