Gem
Gem copied to clipboard
[gemkeyboard] keycodes
Add a description
Gemwin keycode reports through [gemkeyboard] are working only in Capital letters. Also, non english keyboard is not taken into account (testing with french keyboard layout).
what's worse is that the keycodes are highly dependent on the actual windowing backend.
here's a test with a german keyboard layout:
windowing backend | key combination | normal printout | gemkeyboard |
---|---|---|---|
glfw3 | A | a |
65 |
glfw3 | Shift_L+A | A |
340 65 |
glfw3 | Ö | ö |
59 |
glfw3 | Shift_R+Ö | Ö |
344 59 |
glut | A | a |
97 |
glut | Shift_L+A | A |
112 65 |
glut | Ö | ö |
246 |
glut | Shift_R+Ö | Ö |
113 214 |
glx | A | a |
38 |
glx | Shift_L+A | A |
50 38 |
glx | Ö | ö |
47 |
glx | Shift_R+Ö | Ö |
62 47 |
sdl | A | a |
38 |
sdl | Shift_L+A | A |
50 38 |
sdl | Ö | ö |
47 |
sdl | Shift_R+Ö | Ö |
62 47 |
sdl2 | A | a |
4 |
sdl2 | Shift_L+A | A |
225 4 |
sdl2 | Ö | ö |
51 |
sdl2 | Shift_R+Ö | Ö |
229 51 |
as you can see
- some backends will include capitalisation (
glut
), while others will not (glfw3
,glx
, sdl,
sdl2`) - some backends will use unicode points (
glut
at least for the printable characters, but notably not for Shift), others will almost use ASCII (glfw3
where it works for A but not for Ö), some will use XKeyCodes (glx
,sdl
) and some will use their own (sdl2
)
traditionally i've always been torn between exposing low-level functionality and normalizing the output so it is consistent across all windowing backends and platforms. in practice, normalizing the output is a task that i have no hope of implementing.
the important takeaway is, that you should not consider the output of [gemkeyboard]
to be an ASCII value (or unicode point).
it's a number that represents a given key, not a letter.
see also https://github.com/umlaeute/Gem/issues/15