umlaeute / Gem

Graphics Environment for Multimedia (official repository)
https://gem.iem.at
Other
103 stars 30 forks source link

[gemkeyboard] keycodes #414

Open 60-hz opened 9 months ago

60-hz commented 9 months ago

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 commented 9 months ago

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

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 commented 9 months ago

see also https://github.com/umlaeute/Gem/issues/15