beyond-all-reason / Beyond-All-Reason

Main game repository for Beyond All Reason.
https://www.beyondallreason.info/
Other
1.74k stars 290 forks source link

Keyboard layout isn't actually being respected #3836

Open aldrenean opened 2 weeks ago

aldrenean commented 2 weeks ago

Description

Changing the keyboard layout changes the displayed key hints in the grid and blueprint menus, but the keybinds don't actually change.

Expected Behaviour

Changing the layout should change the key binds, not just the key hints.

Actual Behaviour

I believe the sanitizeKey function in keyboard_layouts.lua is responsible for performing the actual remapping of keypresses, but it seems to only be called in various GUI widgets (which explains why the hints change), but not by any of the KeyAction/KeyPress logic.

Reproduction steps

Change the keyboard layout option; you should observe that the keybinds don't actually change, regardless of the hints.

Other

No response

aldrenean commented 2 weeks ago

I'm willing to investigate this further and hopefully fix it, but it sounds like the keybinding system is currently being worked on actively, so I don't want to put in significant effort if my fix might be broken by the new changes.

larsgrah commented 2 weeks ago

I can verify that this happens. If I "manually" correct the bindings in the uikeys.txt file it works, but this is a very annoying workaround, I just discoverd BAR supported non-querty layouts like colemak but the keys are indeed not respected.

Additionally, it seems to look for where the physical key should be, e.g. my german z on colemak gets translated to j? the only reason for this could be that that is where the z key would physically be on a german keyboard, none of these assumptions actually work. It should be that whatever key is entered is actually then used, not where the key positionally should be.

I am happy to cr/qa or work on the PR to fix this.