You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OS: Arch Linux x86_64
Kernel: 6.9.3-arch1-1
DE: Plasma 6.0.5
Graphics Platform: Wayland
Same issue using X11.
When I get SDL_Keycode from key press event I get symbols in keyboard layout at startup, this means that this doesn't correspond to a SDL_Keycode value in the enumeration.
Examples for qwertyuiop keys range:
Startup with en-US selected layout works as intended
Keycodes for keys with printable characters are represented by their Unicode code points.
The Unicode for Q is 113.
The Unicode for й is 1081.
A Russian keyboard has the letter й at the same location as an English keyboard has the letter Q so if you use an English keyboard and change the keyboard layout to Russian then you will get the keycode 1081 when pressing Q.
If you want to handle keys independent of the keyboard layout you should use scancodes instead of keycodes.
If you want to know what the key would be on an en-US keyboard, you can use the function SDL_GetDefaultKeyFromScancode() which was introduced in SDL3 for exactly this purpose.
FYI, SDL3 also removes the SDL_Keycode enum and turns the type into Uint32, so it's more clear that it's not a predefined set of values, the keycode can be any printable key on the keyboard.
System:
Same issue using X11.
When I get SDL_Keycode from key press event I get symbols in keyboard layout at startup, this means that this doesn't correspond to a SDL_Keycode value in the enumeration.
Examples for qwertyuiop keys range:
Startup with en-US selected layout works as intended
Startup with ru-RU selected layout causes incorrect recognition of pressed buttons
Is it supposed to work like this or is it a bug since I can't recognize which buttons were pressed using SDL_Keycode enum?
The text was updated successfully, but these errors were encountered: