Page 1 of 1

[0.17.0] Factorio Not Respecting X11 Keyboard Mapping

Posted: Tue Feb 26, 2019 6:12 pm
by Oofman
Factorio uses the physical key when used in combination with another key, but does see the mapped key when used alone.

How to reproduce:
Any Linux box with X11, run `setxkbmap -option ctrl:swapcaps` to swap caps lock with left ctrl.
Run Factorio
Go to controls menu

(When I refer to Ctrl here, I mean the physical caps lock key, and Caps the physical Left Ctrl key)
Map anything to Ctrl+X, it becomes "X"
Map anything to just Ctrl, it becomes "LEFT CTRL"
Map anything to Caps lock, it becomes "CAPSLOCK"
Map anything to "Caps lock + X", it becomes "CONTROL + X"

Note that this used to work in 0.16

Re: [0.17.0] Factorio Not Respecting X11 Keyboard Mapping

Posted: Tue Feb 26, 2019 6:36 pm
by quyxkh
Came to report this, it ignores the modmap for hotkeys but not for console input.

Re: [0.17.0] Factorio Not Respecting X11 Keyboard Mapping

Posted: Tue Feb 26, 2019 6:55 pm
by ridcully
I'd like to confirm. I removed CAPSLOCK and put CTRL in its place via `xmodmap`. I blame SDL...

Re: [0.17.0] Factorio Not Respecting X11 Keyboard Mapping

Posted: Tue Feb 26, 2019 10:11 pm
by korenchkin
This bugs me as well, although in a slightly different version: I use the `ctrl:nocaps` xkboption (which makes capslock another ctrl key), but in factorio, <capslock>-<key> is recognised as simply <key>, without any modifiers, i.e., <capslock>-<left mouse> is simply <left mouse> (so there is no way to bind this to a useful key). This worked fine all the way back to at least 0.12.

Edit: It's also still present in 0.17.1.

Re: [0.17.0] Factorio Not Respecting X11 Keyboard Mapping

Posted: Wed Feb 27, 2019 7:39 am
by sprigyig
Looks like 17 is now using keycode for modifier detection instead of keysym. Based on xev output on my desktop, keycode is 66 for caps, 37 for left ctl and keysym is 0xffe3 (XK_Control_L) for both keys when caps is mapped to control.

Re: [0.17.0] Factorio Not Respecting X11 Keyboard Mapping

Posted: Wed Feb 27, 2019 8:25 am
by Oofman
Any way to work around this with LD_PRELOAD and custom SDL build (or whatever's used?)

Re: [0.17.0] Factorio Not Respecting X11 Keyboard Mapping

Posted: Wed Feb 27, 2019 11:21 am
by xng
I'd like to confirm this too.

I tried to rebind in the controls interface in game by just pressing the button (in this case Caps Lock that is mapped to Escape on my layout) to toggle menu. The rebinding interface in game understands that press correctly as Escape but and in game it opens the menu when I press it but doesn't close the menu when I press it again (a'ka toggling). It does toggle with my other Escape key that I haven't bound in the controls interface.

This means the game doesn't bind to the location of the key (actual key) but to a context sensitive interpretation of the layout (different keyboard layout in different menu's/game states).

This was no problem in 0.16, and I haven't had this problem in any other game. I can also test this on windows in a short while.

Edit: In my case it works as expected on Windows 10 with the same layout.

Re: [0.17.0] Factorio Not Respecting X11 Keyboard Mapping

Posted: Thu Feb 28, 2019 12:55 am
by legendre6891
I would like to confirm this as well. I use the "ctrl:nocaps" above to map Caps Lock to control, but it seems that this is ignored by Factorio (in the sense that Caps Lock seemingly has no effect whatsoever -- it doesn't register as control nor caps lock).

Re: [0.17.0] Factorio Not Respecting X11 Keyboard Mapping

Posted: Thu Feb 28, 2019 5:06 am
by riddochc
I have the same issue. I normally have caps lock and control swapped in the same manner as others in the thread. I also use a dvorak layout - this means that where most people use "wasd", I use ",aoe" - and this seems to be working fine. But when ctrl:swapcaps is set, the game never detects that control is pressed. This looks like the same behavior described by legendre6891 in a previous comment.

[edit: the key with the word "control" printed on it behaves as "control." So it's not the *exact* same behavior legendre6891 has, since they're using ctrl:nocaps and I'm using ctrl:swapcaps, but I believe it's the equivalent behavior to expect if both are the result of the same underlying bug.]

Re: [0.17.0] Factorio Not Respecting X11 Keyboard Mapping

Posted: Thu Feb 28, 2019 9:28 am
by korenchkin
riddochc wrote: Thu Feb 28, 2019 5:06 am [edit: the key with the word "control" printed on it behaves as "control." So it's not the *exact* same behavior legendre6891 has, since they're using ctrl:nocaps and I'm using ctrl:swapcaps, but I believe it's the equivalent behavior to expect if both are the result of the same underlying bug.]
For what it's worth, I also use `ctrl:nocaps`, and the key labeled “control” is correctly recognised as the control modifier, whereas the “capslock” key is not recognised at all.

Re: [0.17.0] Factorio Not Respecting X11 Keyboard Mapping

Posted: Thu Feb 28, 2019 10:04 am
by killerbee13
korenchkin wrote: Thu Feb 28, 2019 9:28 am
riddochc wrote: Thu Feb 28, 2019 5:06 am [edit: the key with the word "control" printed on it behaves as "control." So it's not the *exact* same behavior legendre6891 has, since they're using ctrl:nocaps and I'm using ctrl:swapcaps, but I believe it's the equivalent behavior to expect if both are the result of the same underlying bug.]
For what it's worth, I also use `ctrl:nocaps`, and the key labeled “control” is correctly recognised as the control modifier, whereas the “capslock” key is not recognised at all.
I have similar behavior to korenchkin, but I'm using xmodmap instead of xkb. The key labeled "Caps Lock" on my keyboard is LCtrl, and the key labeled "Ctrl" on my keyboard is mapped to Meta (Factorio calls it "Left GUI" for some reason) and is unsuitable as an application modifier because it is bound to global window manager shortcuts. (For instance, Meta + D minimizes all windows—very inconvenient with WASD controls.)

Re: [0.17.0] Factorio Not Respecting X11 Keyboard Mapping

Posted: Tue Apr 16, 2019 8:12 am
by posila
Thanks for the report.
Remapping of modifier keys should be respected in 0.17.32.
See also: 65881

Edit (Copied from 65881 as this thread ended up being linked in the changelog): If you swap keys (eg. you swap Ctrl and Caps Lock) it should work, if you map some non-modifier key as extra modifier (eg. you map Caps Lock as the third Control), it won't work.