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 not recognizing 'space' on some keyboards #2000

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

SDL not recognizing 'space' on some keyboards #2000

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

SDLBugzilla commented Feb 11, 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: Linux, x86_64

Comments on the original bug report:

On 2015-10-15 20:03:32 +0000, Drew Bliss wrote:

This report

ValveSoftware/Dota-2#453

has a user where when pressing space SDL doesn’t recognize the key as space.

SDL: got SDL_KEYDOWN
KEYDOWN (keyc): sdlkeycode=1073741824 sdlscancode=44 SDL_GetKeyName='' buttoncode=0 buttonname='' ButtonCode_GetLocalKeyNameUTF8=''
SDL: got SDL_TEXTINPUT
TEXTINPUT ' '
SDL: got SDL_KEYUP
KEYUP (keyc) 0 ()

The scancode of 44 is normal (SDL_SCANCODE_SPACE) but then the keycode is SDLK_SCANCODE_MASK | SDL_SCANCODE_UNKNOWN. It seems like something may be not working when building the keymap? I think it’s a Latvian keyboard layout.

His system info:
Linux (64 bit)
Kernel Name: Linux
Kernel Version: 4.2.2-1-ARCH
X Server Vendor: The X.Org Foundation
X Server Release: 11702000
X Window Manager: GNOME Shell

On 2016-02-08 06:19:49 +0000, Ryan C. Gordon wrote:

I can't reproduce this here, but I can't help but think either this broke it...

https://hg.libsdl.org/SDL/rev/8a89b58895c1

...or this is an Arch-specific bug?

Specifically, it looks like the failure is here...

https://hg.libsdl.org/SDL/file/c31b24c7babc/src/video/x11/SDL_x11keyboard.c#l329

...which lands here...

https://hg.libsdl.org/SDL/file/c31b24c7babc/src/video/x11/SDL_x11keyboard.c#l182

...which presumably returns NoSymbol. The fallback once this happens...

https://hg.libsdl.org/SDL/file/c31b24c7babc/src/video/x11/SDL_x11keyboard.c#l333

...only works on US QWERTY keyboards, so we end up with that SDLK_SCANCODE_MASK | SDL_SCANCODE_UNKNOWN in that switch statement's default case.

I've updated the table in X11_KeySymToUcs4(), but presumably we never got this far, and it looks like it was right except for a small unrelated thing. We'd have to deep-dive on this person's computer (including the keyboard he's using) to get further now, I think. I'll ask him to run xev.

--ryan.

On 2016-03-11 09:25:05 +0000, magist3r wrote:

Created attachment 2394
xev on us layout

On 2016-03-11 09:25:38 +0000, magist3r wrote:

Created attachment 2395
xev on ru layout

On 2016-03-11 09:26:52 +0000, magist3r wrote:

I've added logs from xev. I pressed button '1' after starting command with en and ru locales. In Dota2 it recognizes sometimes as RETURN.

On 2016-05-15 15:26:25 +0000, K900 wrote:

I've got the same issue on one of my laptops. Do you guys need any more info?

On 2017-10-23 19:23:32 +0000, Ori Avtalion wrote:

I think I'm affected by this, but not sure.
Willing to perform any tests you wish.

I have a keyboard that's usually set to US English, but I also use a Hebrew layout.

The first game where I 'space' didn't work is Thimbleweed Park. 'space' is supposed to pause the game, but instead did nothing. It was magically fixed after a while, likely tied to an update, but I'm not sure. They never updated their SDL version (2.0.5), and made no discernible changes to the UI code.

The game Opus Magnum was just released, using SDL 2.*. It makes two uses of the space key: as a hotkey to activate an action, which doesn't work for me, and for inputting arbitrary text, which does work.

On 2017-12-09 13:10:33 +0000, Ori Avtalion wrote:

Follow-up to my previous comment:

Opus Magnum ships with SDL 2.0.4, and if I link it against 2.0.5 onwards, the space key is recognized correctly.

I tried bisecting the code to find the fix, and I think it's this one:

changeset: 10439:0426a82e291d
user: Sam Lantinga slouken@libsdl.org
date: Sat Oct 01 14:22:10 2016 -0700
summary: Fixed bug 3130 - Spacebar not responding

On 2017-12-09 18:38:56 +0000, Sam Lantinga wrote:

Great, thanks!

On 2017-12-09 19:00:05 +0000, Ozkan Sezer wrote:

Is this really fixed now? If so, by which commit?

On 2017-12-09 19:12:44 +0000, Ori Avtalion wrote:

(In reply to Ozkan Sezer from comment # 9)

Is this really fixed now? If so, by which commit?
As mentioned above, my testing implies it's this one:
https://hg.libsdl.org/SDL/rev/0426a82e291d

Some of the commits around it failed to compile, but this is the first one where the space key worked on my test program.

On 2017-12-09 19:20:28 +0000, Ozkan Sezer wrote:

OK, I see; I misinterpreted your comment in a way that that commit
started your issue. Sorry for the noise.

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