ValveSoftware / steam-for-linux

Issue tracking for the Steam for Linux beta client
4.18k stars 173 forks source link

HL1: Key bindings break with different keyboard layouts #853

Closed antonwe closed 11 years ago

antonwe commented 11 years ago

Hello,

I'm frequently accessing the console when playing GoldSrc games, which is normally opened through the ~ key (to the left of 1, above tab) on the keyboard. The -console parameter may have to be passed as a launch option. However, I'm using the Swedish keyboard layout, where this key produces a §. In GoldSrc games in Windows, the keyboard layout is fixed/locked to the US layout, which prevents this issue. In Linux, the system keyboard layout seem to be applied in the game as well, which causes certain key bindings to break.

This wouldn't be a problem unless the "swedish" character that this key produces can't be bound at all....

Simply reproducable through: setxkbmap se --> start game --> the console key doesn't work.

I love you guys for finally going through with this btw :)

Thanks, /Anton

UPDATE: Some people seem to think that I can simply bind the correct key to make it work again, but this isn't possible since HL1 doesn't recognize this key.

if add: bind "§" toggleconsole into userconfig.cfg, i get this:

"§" isn't a valid key

mrshankly commented 11 years ago

I'm not sure if this works since I'm not able to test it at the moment, but try to edit the config.cfg file.

Mine is at ~/.local/share/Steam/SteamApps/common/Half-Life/, some people seem to have their steam folder at another location, so check if yours is at ~/.local/share/ or not.

Once there open the config.cfg file and search for bind "~" "toggleconsole", change the "~" with whichever key you want and see if it works. If you can open the console in-game you can use the bind command there too, but I think you will have to do it every time you start the game.

AnAkkk commented 11 years ago

This is normal. And this is no longer the case in Windows either, as it now correctly set the keyboard layout, as in Source games. As the ~ key is not at the same place with your keyboard layout, the default bind is obviously not going to work as the key "moved". Just change the bind as mrshankly said.

https://github.com/ValveSoftware/steam-for-linux/issues/841

lzap commented 11 years ago

I can confirm this, I have a Czech and English layout set in my Fedora (Czech is the default) and when the game starts, it completely ignores all numbers because these are mapped to special Czech characters. The game does not work with them, even when I switch the layout using my SHIFT-SHIFT combination which I use to switch them.

Now the strange thing is when I go to the Options and I try to bind those Czech keys, it does recognize them as numbers. Pretty strange.

+1 THANKS for doing this Valve. You guys rock :)

antonwe commented 11 years ago

This is not as trivial as you seem to think, since HL1 does not recognize § as a valid key...

if add: bind "§" toggleconsole into userconfig.cfg, i get this:

"§" isn't a valid key

.......AND hence this issue report. I should be able to use that key.

/Anton

lzap commented 11 years ago

I confirm, HL1 does not recognize non-US keys. For Czech keyboard, we have "+ěščřžýáí" in the first row and non of these are recognized. Unfortunately HL1 does not recognize even when I switch to English layout. When I open up the HL1 console, it prints numbers instead those characters (which is correct because I switched over to English layout), but in the game it does not recognize.

lzap commented 11 years ago

@deppan what is your X11 config in regard to the keyboard? Mine is:

Section "InputClass"
    Identifier  "system-setup-keyboard"
    MatchIsKeyboard "on"
    Option      "XkbModel"  "pc105"
    Option      "XkbLayout" "cz,us"
    Option      "XkbVariant"    "qwerty"
    Option      "XkbOptions"    "terminate:ctrl_alt_bksp,grp:shifts_toggle,grp_led:scroll"
EndSection

I bet when I change the XkbLayout to "us,cz" it will work.

lzap commented 11 years ago

Ok the workaround is to switch to US layout before starting the game:

setxkbmap -layout us

Please note you need to switch using this command, using keyboard layout toggle is not enough. You need to re-set kb mapping in X11, otherwise this will not work.

jooiiee commented 11 years ago

Confirming problem with ubuntu 12.10 64b + swedish qwerty. Will test lzap's fix in a moment.

jooiiee commented 11 years ago

Fix posted by lzap works.

alfred-valve commented 11 years ago

This will be fixed in the next update.

antonwe commented 11 years ago

Thanks for this.

By the way, I just realized that the game still behaves differently on different keyboard layouts. This may apply on Windows, and in source games as well. With the .us layout, the ~ key (which by default is bound to "toggleconsole") happens to be the same key as the hardcoded console key, which isn't the case on other layouts. As such, the console behaves differently:

On the .us layout:

On other layouts:

This behavior can be verified by others by switching layouts with setxkbmap and restarting the game.

IMO, the behavior should be the same between layouts... So perhaps it's time to remove the default toggleconsole binding? And maybe mirror its functionality to the hardcoded variant.

BR, /Anton

licaon-kter commented 11 years ago

Still not fixed, Dvorak here.

AnAkkk commented 11 years ago

It is fixed, but the fix actually cause another problem: https://github.com/ValveSoftware/steam-for-linux/issues/1023

licaon-kter commented 11 years ago

If the so called fix causes other issues somewhere else is not important as long as it does not help with this issue in the first place.

johndrinkwater commented 11 years ago

@licaon-kter since #1023 was fixed in the last update, would you confirm that the problem is fixed? If not, please report a new bug for dvorak.

licaon-kter commented 11 years ago

Yep, fixed, works fine with Dvorak. :D