[Donion] [1.1.82] CTRL key stopped working on Linux

Post Reply
Pi-C
Smart Inserter
Smart Inserter
Posts: 1629
Joined: Sun Oct 14, 2018 8:13 am
Contact:

[Donion] [1.1.82] CTRL key stopped working on Linux

Post by Pi-C »

I've backed up my Factorio folder for version 1.1.81 and updated to 1.1.82. When I tried to use CTRL+F to find a saved game, it didn't work, and going to Settings--> Controls, I noticed that the CTRL key is ignored altogether.

I've restarted my system (Debian/Sid, with MATE desktop) after yesterday's updates, so there was a slight chance that something might have been borked with the updates. However, switching to the backup folder and starting Factorio 1.1.81, the CTRL key worked as expected again. So it seems that updating Factorio to 1.1.82 disabled the CTRL key. (Actually, the CTRL key works as expected with all other programs, only Factorio ignores it.)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Donion
Factorio Staff
Factorio Staff
Posts: 161
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: 1.1.82: CTRL key stopped working on Linux

Post by Donion »

Do you have your Ctrl mapped to/swapped with some other key? Or any other custom keyboard settings? Are you using Wayland?

User avatar
jodokus31
Smart Inserter
Smart Inserter
Posts: 1597
Joined: Sun Feb 26, 2017 4:13 pm
Contact:

Re: 1.1.82: CTRL key stopped working on Linux

Post by jodokus31 »

Probably related to this:
106031

Pi-C
Smart Inserter
Smart Inserter
Posts: 1629
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: 1.1.82: CTRL key stopped working on Linux

Post by Pi-C »

Donion wrote:
Tue May 23, 2023 9:54 am
Do you have your Ctrl mapped to/swapped with some other key? Or any other custom keyboard settings? Are you using Wayland?
No, I'm not using Wayland. After some experimenting I've found that my mouse preferences interfered with the CTRL key:
mouse_prefs.png
mouse_prefs.png (64.88 KiB) Viewed 1052 times
Turning off this setting will enable CTRL in Factorio 1.1.82, turning it on again disables CTRL. I'm not sure why this happens all of a sudden, I've used this setting for years and it didn't affect Factorio until now. (Actually, I've had this issue before, but it had been fixed in 0.17.44.)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Donion
Factorio Staff
Factorio Staff
Posts: 161
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: 1.1.82: CTRL key stopped working on Linux

Post by Donion »

I was afraid of that.
The reason why all this is happening is that recently I've updated SDL to a newer version and the fix for your issue was breaking a bunch of other cases.
I've tested a similar "show cursor position" functionality on my setup and it works without a problem in 1.1.82, but clearly your specific one does things differently.
I will try to reproduce it on my end and figure out a new fix. In the meantime you should disable the feature (or try using a different tool, if you do try and it's broken as well, please, let me know) or use the previous version. I'm sorry for the inconvenience.

Update: I can reproduce it on Mint with Cinnamon

Pi-C
Smart Inserter
Smart Inserter
Posts: 1629
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: 1.1.82: CTRL key stopped working on Linux

Post by Pi-C »

Donion wrote:
Tue May 23, 2023 12:44 pm
I will try to reproduce it on my end and figure out a new fix. In the meantime you should disable the feature (or try using a different tool, if you do try and it's broken as well, please, let me know) or use the previous version. I'm sorry for the inconvenience.
I've disabled the feature for now. Highlighting the cursor position is a nice-to-have feature but not essential, and now that I know how to get back the CTRL key, I can live with that for a while.
Update: I can reproduce it on Mint with Cinnamon
Great! So there is a chance that you'll find a fix as well. Thanks a lot for your efforts! :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Donion
Factorio Staff
Factorio Staff
Posts: 161
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: [Donion] [1.1.82] CTRL key stopped working on Linux

Post by Donion »

I've looked into this further now, with SDL 2.30.0 and this is what's happening when I have the "show cursor when Ctrl is pressed" enabled on Mint with Cinnamon:
  1. I press Ctrl key
  2. Factorio receives FocusOut event
  3. I release Ctrl key
  4. Factorio receives FocusOut event (I don't know why there is this second FocusOut event)
  5. Factorio receives FocusIn event
  6. Factorio receives KeymapNotify event, the X11 driver reconciles the keyboard state.
This looks reasonable, however, by the time Factorio receives the KeymapNotify event the Ctrl is already released so the keyboard reconciliation doesn't really do anything and the Ctrl key press and release is lost to us.
In the past Oxyd put in several workarounds to reconcile the keyboard state also on every key press and mouse click, I have since removed those as they were causing other issues. Also this approach wouldn't work for actions bound to just "Ctrl" (for example, if you have Alt-mode key set as Ctrl).
I'm leaning towards leaving this as a minor issue.

I might revisit this later, ideally by having a fix in upstream SDL.

Post Reply

Return to “Assigned”