minetest / minetest

Minetest is an open source voxel game-creation platform with easy modding and game creation
https://www.minetest.net/
Other
10.59k stars 2k forks source link

Keys are either mis-detected or mis-labeled in keybinding dialog (Neo2 keyboard layout) #13904

Open erlehmann opened 10 months ago

erlehmann commented 10 months ago

Minetest version

5.7.0-279-gb1dec37ad
5.7.0-350-g8a9855241

Active renderer

OpenGL 1.4

Irrlicht device

X11 / SDL (both are bugged, but in a different way)

Operating system and version

Debian GNU/Linux 11.7

CPU model

Intel(R) Core(TM) Duo CPU T2400 @ 1.83GHz

GPU model

Intel Corporation Mobile 945GM/GMS/GME, 943/940GML Express Integrated Graphics Controller (rev 03)

OpenGL version

1.4

Summary

I tried to bind some keys in the keybinding dialog and think they are either mistranslated or mis-detected by Minetest:

Here are the keys I pressed, the German label I see after pressing them and what that translates to:

Edit: The Num Lock key is apparently set to an actual tab character on my system.

Meanwhile, the Menu and Tab keys are correctly detected/labeled as ”Menü” and “Tab”.

My keyboard is a QWERTY keyboard with a numpad and my keyboard layout is German (Neo 2).

Steps to reproduce

  1. Start Minetest with German (Neo 2) keyboard layout and German locale.
  2. Try to bind some keys to some functions in the keybinding dialog.
  3. Look at the names of the keys that are diplayed.
erlehmann commented 10 months ago

It seems that this issue is not translation-related: When I press the right “alt” key (in X11 lingo: ISO_Level5_Shift) in Minetest started with LANG=C, it displays “Left Button”.

rubenwardy commented 10 months ago

This is another thing that show be fixed by SDL

erlehmann commented 10 months ago

I tried with a different keyboard (Thinkpad T60 QWERTZ) and had the same results, except that the Fn key was also detected as “Linke Taste” / “Left Button”, which probably means it is impossible to use numpad keys on laptops with the current version of Minetest (not that I do that, but …).

This is another thing that show be fixed by SDL

@rubenwardy do you mean it should be (i.e. will be) fixed some day or it should have (i.e. has) already been fixed?

erlehmann commented 10 months ago

@rubenwardy so I compiled Minetest at commit 5.7.0-350-g8a9855241 with SDL now and got the following:

I can almost see a pattern here, but ß is not recognized at all.

Edit: If anything, using SDL is worse than not using SDL here.

grorp commented 10 months ago

I think rubenwardy meant that it's possible to fix this using SDL, by replacing our own key name logic with SDL_GetKeyName.

erlehmann commented 10 months ago

@v-rob has written a small SDL program to check keycodes and scancodes: https://gist.github.com/v-rob/4ef28c7ae9f45fcf697dbc0f3a64ee5c

This is the result (partially correct, but still broken for modifier and dead keys):

v-rob commented 10 months ago

Looking at the Neo2 layout, scancodes all work as expected, which is good. Hopefully, we can use transition to SDL scancodes for in-game controls instead of keycodes. Formspecs still require keycodes (for e.g. shortcuts like Ctrl+C, not for character input), so we can't add scancode support until we fully transition to SDL.

rubenwardy commented 1 month ago

related: #14940

Zughy commented 3 weeks ago

QWERTY Italian keyboard, can confirm, my \ is OEM5