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] Fix Key and Textinput event order on X11 (issue introduced post-2.0.3) #1659

Closed
SDLBugzilla opened this issue Feb 10, 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.0
Reported for operating system, platform: Linux, All

Comments on the original bug report:

On 2014-10-08 02:16:12 +0000, Zack Middleton (zturtleman) wrote:

Created attachment 1890
X11: Add textinput event after key event

The X11 IBUS support changes made SDL_TEXTINPUT event come before SDL_KEYDOWN event. This is inconsistent with SDL's X11 backend in 2.0.3 and other SDL backends I've tested or looked at the SDL code for (Windows, DirectFB, Cocoa, iOS, Mir, and Wayland).

I found this because the in-game console in ioquake3 (which I'm a developer of) can be toggled using ` (grave) key or character event. The textinput handler ignores text if last key was console toggle. With the current mercurial SDL2 X11 code the console gets toggled twice each press (cannot open) due to textinput event before key event.

The attached patch makes SDL X11 backend add SDL_KEYDOWN event before SDL_TEXTINPUT event. I don't think this affects IBUS. With and without this patch; if SDL_IBus_ProcessKeyEvent handles the key event, the function calls to add SDL key and textinput events in X11_DispatchEvent are not run.

On 2014-10-13 17:06:53 +0000, Alex Baines wrote:

Created attachment 1897
Pump IBus events after XEvents to make sure TEXTINPUT comes after KEYDOWN

Looks like I broke this, sorry about that!

Your patch looks good, I've made an additional one that pumps the IBus events after the X events. This should make sure you always get the KEYDOWN ones first even if IBus handled the key press.

On 2015-02-19 05:22:19 +0000, Ryan C. Gordon wrote:

Marking a large number of bugs with the "triage-2.0.4" keyword at once. Sorry if you got a lot of email from this. This is to help me sort through some bugs in regards to a 2.0.4 release. We may or may not fix this bug for 2.0.4, though!

On 2015-04-07 04:57:58 +0000, Ryan C. Gordon wrote:

(sorry if you get a lot of copies of this email, I'm marking several bugs at once)

Marking bugs for the (mostly) final 2.0.4 TODO list. This means we're hoping to resolve this bug before 2.0.4 ships if possible. In a perfect world, the open bug count with the target-2.0.4 keyword is zero when we ship.

(Note that closing a bug report as WONTFIX, INVALID or WORKSFORME might still happen.)

--ryan.

On 2015-05-27 00:23:50 +0000, Ryan C. Gordon wrote:

Whoops, I fixed this independently, too, with the exact same change that Zack made.

https://hg.libsdl.org/SDL/rev/e0e2e94ce5ea

I've put Alex's patch in revision control, too...

https://hg.libsdl.org/SDL/rev/044cafe15108

...which should resolve this bug.

Thanks!

--ryan.

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