We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3130

Summary: Spacebar not responding
Product: SDL Reporter: kongr45gpen <electrovesta>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2 CC: alex, kubissus, sezeroz
Version: HG 2.0   
Hardware: x86_64   
OS: Linux   
Attachments: Experimental patch to correct groups sent to XkbKeycodeToKeysym
Patch to correct XkbKeycodeToKeysym groups v2
Patch to correct XkbKeycodeToKeysym groups v3

Description kongr45gpen 2015-09-26 21:36:04 UTC
The space key does not seem to be responding on the latest changeset (9879:8465a79c9f85 - https://hg.libsdl.org/SDL/changeset/8465a79c9f85) from Mercurial SDL.

After using hg's bisect, I was able to narrow down the issue to 9842:8a89b58895c1 (http://hg.libsdl.org/SDL/rev/8a89b58895c1).

Note that SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM is set to 1 for my build.
Comment 1 Alex Baines 2015-09-29 20:38:52 UTC
I can't personally reproduce this, but it might be that the group obtained from XkbGetState is out of range for the call to XkbKeycodeToKeysym for that particular (space) key.

I think we're supposed to check XkbKeyGroupInfo + XkbKeyNumGroups and manually correct the group before calling XkbKeyCodeToKeysym. Atleast that's what this stackoverflow answer seems to suggest: http://stackoverflow.com/a/10233743

It seems really weird that XkbKeycodeToKeysym wouldn't do that internally though...
Comment 2 kongr45gpen 2015-09-30 14:31:07 UTC
The call to XkbKeycodeToKeysym does return NoSymbol for me, suggesting that the group is out of range for that key.
Comment 3 Alex Baines 2015-09-30 19:51:09 UTC
Created attachment 2280 [details]
Experimental patch to correct groups sent to XkbKeycodeToKeysym

Try this patch, hopefully it will fix the problem.
Comment 4 kongr45gpen 2015-09-30 19:56:39 UTC
Yup, the patch has fixed the issue, thanks!
Comment 5 Alex Baines 2015-10-01 17:19:51 UTC
Created attachment 2282 [details]
Patch to correct XkbKeycodeToKeysym groups v2

Here's a better version of the patch that only remaps the group if it was actually out of range.
Comment 6 Alex Baines 2015-10-01 19:18:44 UTC
Created attachment 2283 [details]
Patch to correct XkbKeycodeToKeysym groups v3

I was using XkbOutOfRangeGroupInfo instead of XkbOutOfRangeGroupNumber in the last patches, this one fixes that. 

Hopefully this one does everything as it should, kinda hard to know since the documentation on this stuff is pretty much non-existent.
Comment 7 Sam Lantinga 2016-10-01 21:22:49 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/0426a82e291d