[0.17.0] Factorio Not Respecting X11 Keyboard Mapping

This subforum contains all the issues which we already resolved.
Post Reply
Oofman
Manual Inserter
Manual Inserter
Posts: 2
Joined: Tue Feb 26, 2019 6:05 pm
Contact:

[0.17.0] Factorio Not Respecting X11 Keyboard Mapping

Post 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

quyxkh
Filter Inserter
Filter Inserter
Posts: 964
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: [0.17.0] Factorio Not Respecting X11 Keyboard Mapping

Post by quyxkh »

Came to report this, it ignores the modmap for hotkeys but not for console input.

ridcully
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sun Jul 05, 2015 7:11 pm
Contact:

Re: [0.17.0] Factorio Not Respecting X11 Keyboard Mapping

Post by ridcully »

I'd like to confirm. I removed CAPSLOCK and put CTRL in its place via `xmodmap`. I blame SDL...

korenchkin
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Aug 21, 2015 12:56 am
Contact:

Re: [0.17.0] Factorio Not Respecting X11 Keyboard Mapping

Post 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.

sprigyig
Manual Inserter
Manual Inserter
Posts: 2
Joined: Sat Jul 23, 2016 2:31 am
Contact:

Re: [0.17.0] Factorio Not Respecting X11 Keyboard Mapping

Post 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.

Oofman
Manual Inserter
Manual Inserter
Posts: 2
Joined: Tue Feb 26, 2019 6:05 pm
Contact:

Re: [0.17.0] Factorio Not Respecting X11 Keyboard Mapping

Post by Oofman »

Any way to work around this with LD_PRELOAD and custom SDL build (or whatever's used?)

xng
Fast Inserter
Fast Inserter
Posts: 164
Joined: Fri Feb 14, 2014 1:04 pm
Contact:

Re: [0.17.0] Factorio Not Respecting X11 Keyboard Mapping

Post 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.

legendre6891
Manual Inserter
Manual Inserter
Posts: 2
Joined: Wed Feb 27, 2019 11:12 pm
Contact:

Re: [0.17.0] Factorio Not Respecting X11 Keyboard Mapping

Post 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).

riddochc
Manual Inserter
Manual Inserter
Posts: 2
Joined: Thu Feb 28, 2019 4:52 am
Contact:

Re: [0.17.0] Factorio Not Respecting X11 Keyboard Mapping

Post 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.]

korenchkin
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Aug 21, 2015 12:56 am
Contact:

Re: [0.17.0] Factorio Not Respecting X11 Keyboard Mapping

Post 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.

killerbee13
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sat May 07, 2016 11:28 pm
Contact:

Re: [0.17.0] Factorio Not Respecting X11 Keyboard Mapping

Post 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.)

posila
Factorio Staff
Factorio Staff
Posts: 5147
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [0.17.0] Factorio Not Respecting X11 Keyboard Mapping

Post 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.

Post Reply

Return to “Resolved Problems and Bugs”