![]() |
Why can't SDL 2.0 handle custom keyboard mappings? | ![]() |
![]() |
Why can't SDL 2.0 handle custom keyboard mappings? | ![]() |
Lewis Wall
Guest
![]() |
![]() |
I investigated the source code on my own and found out that src/video/x11/SDL_x11keyboard.c is detecting the OSs scancode table through use of a fingerprint which contains (home, page up, page down), which are 3 of the 4 keys I have remapped. To allow SDL to deal gracefully with this, I expanded the fingerprint to (home, page up, up, left, delete, KP enter), with an extra condition that only four of the six entries must be correct for it to decide on the scancode table. This should make it so that people who have remapped only a few keys will still be able to use SDL-based games.
I would love to help out, but I am not familiar with the patch request/code review process for this codebase. I've tentatively attached a patch file to this email, but if there is a better way for me to submit this, please let me know. Sorry for the trouble. On Wed, Mar 19, 2014 at 12:45 AM, Lewis Wall wrote:
|
||||||||||||
|
![]() |
Why can't SDL 2.0 handle custom keyboard mappings? | ![]() |
Sam Lantinga
![]() |
![]() |
Typically people enter bugs at http://bugzilla.libsdl.org and attach patches so they don't get lost on the e-mail list.
I got your patch in though, thanks! https://hg.libsdl.org/SDL/rev/fb44c438a3e5 On Sat, Mar 22, 2014 at 8:37 PM, Lewis Wall wrote:
|
||||||||||||||
|
![]() |
Why can't SDL 2.0 handle custom keyboard mappings? | ![]() |
Lewis Wall
Guest
![]() |
![]() |
Thanks. I'll remember that for next time.
On Sun, Mar 23, 2014 at 9:45 AM, Sam Lantinga wrote:
|
||||||||||||||||
|
![]() |
Why can't SDL 2.0 handle custom keyboard mappings? | ![]() |
Jonny D
![]() |
![]() |
I've run into this problem too.
The patch still seems like a flaky/brittle solution. Does anyone know of a better method for X11 layout detection? Jonny D |
||||||||||
|
![]() |
Why can't SDL 2.0 handle custom keyboard mappings? | ![]() |
Stefanos A.
Guest
![]() |
![]() |
IIRC, the XInput2 extension reports raw key events, before being processed by the server. [1] I haven't verified this, but it might be possible to obtain key codes before layout mapping on the server, avoiding the layout detection hack entirely.
That said, I wouldn't be surprised if layout-independent scancodes turn out impossible to implement through X11. In that case, the current hack is pretty much the best it can get. [1] http://who-t.blogspot.ch/2009/07/xi2-recipes-part-4.html 2014-03-23 21:02 GMT+01:00 Jonathan Dearborn:
|
||||||||||||
|