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

[gemkeyboard] keycodes #414

Open
60-hz opened this issue Feb 21, 2024 · 2 comments
Open

[gemkeyboard] keycodes #414

60-hz opened this issue Feb 21, 2024 · 2 comments

Comments

@60-hz
Copy link
Contributor

60-hz commented Feb 21, 2024

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).

@umlaeute
Copy link
Owner

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.

@umlaeute
Copy link
Owner

see also #15

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

2 participants