Navigation Menu

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_EnableUNICODE sometimes drops keyboard events completely #744

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

SDL_EnableUNICODE sometimes drops keyboard events completely #744

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

Comments on the original bug report:

On 2013-12-24 04:26:03 +0000, Rafał Mużyło wrote:

The most annoying part of this bug is that though I've found it in two separate apps, I don't have a trivial testcase for it.

The problem seems to be a condition race, as it's triggered quite randomly (therefore it will be hard to tell whether it really gets fixed, if a probable fix is found).

While it's specific to SDL 1.2, it seems quite similar to the problem described and fixed in http://forums.libsdl.org/viewtopic.php?p=40503.

Now, I should start describing the problem.

A game uses Escape to open menu (the exact key might not be important). Upon opening, it calls SDL_EnableUNICODE(1). Upon closing it calls SDL_EnableUNICODE(0).

I have an IME running.

Game uses SDL_PollEvent to get the events.

If Escape is pressed repeatedly, menu is opened and closed, till it eventually freezes in open state.
"freezes" in this context means "app itself still runs, but no keyboard events are getting delivered (though - for example - mouse events still are)". "getting delivered" should mean "SDL_PollEvent is not receiving any".
If it matters, the last delivered keyboard event is a keypress, the release never arrives.

It seems (no guarantees, due to random nature of the freeze) that unsetting XMODIFIERS (which - AFAIU - will disable IME as far as SDL is concerned) prevents the freeze, therefore the reference to that SDL2 thread.

On 2014-01-02 16:05:11 +0000, Rafał Mużyło wrote:

Created attachment 1510
change that sems to make a difference

This patch is based on the one in the mentioned above thread. It seems to fix the problem.

Of course:

  • it's an obvious case of cargo cult, so no idea of how correct it actually is
  • given the random nature of the freeze, I'm not even 10% if it really prevent the freeze or simply significantly delays it

Though that little note on XEventFilter manpage at the end of description makes me wonder...

On 2014-01-29 01:40:55 +0000, Rafał Mużyło wrote:

Created attachment 1545
a slight correction of the previous patch

Previous version affected input in the way it shouldn't have - corrected it a little.

On 2014-03-17 08:52:49 +0000, Ozkan Sezer wrote:

I think this is the bug that affects uHexen2:
http://sourceforge.net/p/uhexen2/discussion/425207/thread/6f168cfb/

Is there any intention of fixing it in SDL-1.2?

On 2014-04-18 05:37:01 +0000, Sam Lantinga wrote:

Fixed, thanks!
https://hg.libsdl.org/SDL/rev/0aade9c0203f

On 2018-08-13 07:11:56 +0000, Rene Dudfield wrote:

Arch Linux includes this patch: https://git.archlinux.org/svntogit/packages.git/tree/trunk/SDL-1.2.15-SDL_EnableUNICODE_drops_keyboard_events.patch?h=packages/sdl

On 2018-08-13 11:46:17 +0000, Ozkan Sezer wrote:

(In reply to Rene Dudfield from comment # 5)

Arch Linux includes this patch:
https://git.archlinux.org/svntogit/packages.git/tree/trunk/SDL-1.2.15-
SDL_EnableUNICODE_drops_keyboard_events.patch?h=packages/sdl

That patch is already in the SDL-1.2 branch.

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