Page 1 of 1

[raiguard][2.0.7][Linux][wayland] Videodriver set to wayland --> Keyboard doesnt work

Posted: Mon Oct 21, 2024 2:11 pm
by p0lle
Iam on Kubuntu 24.10 with wayland and kde Plasma 6.1.5.

If I set the setting "preferred Video driver" in the Factorio Settings menu to Wayland, I have to press AND hold the Left Shiftlock Button to be able to issue any Keyboard commands. For example: I cannot move with W,A,S,D. I have to Press and hold the left shiftlock button and W to move upwards.

If I set it back to X11, the Keyboard works fine.

Re: [2.0.7][Linux][wayland] Videodriver set to wayland --> Keyboard doesnt work

Posted: Mon Oct 21, 2024 2:55 pm
by raiguard
Thanks for the report. Can you post a log file so I can see your environment, and can you tell me which distribution and desktop environment you are running?

Re: [2.0.7][Linux][wayland] Videodriver set to wayland --> Keyboard doesnt work

Posted: Mon Oct 21, 2024 5:43 pm
by p0lle
Sorry for forgetting the log... I should read better. It should be attached now.

Kubuntu 24.10
KDE Plasma 6.1.5
Kernel: 6.11.0-8-generic
Graphics Platform: Wayland
GPU; Intel UHD Graphics 620

Re: [2.0.7][Linux][wayland] Videodriver set to wayland --> Keyboard doesnt work

Posted: Tue Oct 22, 2024 7:19 pm
by raiguard
Can you add SDL_EVENT_LOGGING=1 to your environment, reproduce the issue, then upload the log? I would like to see what the SDL keyboard events look like.

Edit: I just remembered that SDL won't print to the log, but only to stdout. So you really want to do this:

Code: Select all

SDL_EVENT_LOGGING=1 path/to/executable
Then copy/paste the terminal output into a file and upload that.

I tried redirecting SDL event logging to a file but couldn't get it to work...

Re: [raiguard][2.0.7][Linux][wayland] Videodriver set to wayland --> Keyboard doesnt work

Posted: Wed Oct 23, 2024 12:07 pm
by p0lle
Meanwhile i updated to [2.0.9] and I did use:

Code: Select all

SDL_EVENT_LOGGING=1 ~/Games/factorio-spaceage/bin/x64/factorio &> factorio-console.log
and got this output, is that what you are looking for? Before exiting the game i switched between going to the right by pressing D, with and without using the Left Shiftlock. The Interesting events should be direct at the end.

edit: I just realized i can also press CTRL instead of Shiftlock to walk

Re: [raiguard][2.0.7][Linux][wayland] Videodriver set to wayland --> Keyboard doesnt work

Posted: Wed Oct 23, 2024 12:18 pm
by p0lle
more detailed:
if I just press the key d, i cannot walk and the log says:

Code: Select all

INFO: SDL EVENT: SDL_TEXTINPUT (timestamp=369484 windowid=1 text='d')
INFO: SDL EVENT: SDL_TEXTEDITING (timestamp=369484 windowid=1 text='' start=0 length=0)

If I press shiftlock and d, I can walk also walk and the log says:

Code: Select all

INFO: SDL EVENT: SDL_KEYDOWN (timestamp=533720 windowid=1 state=pressed repeat=false scancode=57 keycode=1073741881 mod=0)
INFO: SDL EVENT: SDL_KEYDOWN (timestamp=534285 windowid=1 state=pressed repeat=false scancode=7 keycode=100 mod=0)
INFO: SDL EVENT: SDL_TEXTINPUT (timestamp=534285 windowid=1 text='D')
INFO: SDL EVENT: SDL_KEYUP (timestamp=534756 windowid=1 state=released repeat=false scancode=7 keycode=100 mod=0)
INFO: SDL EVENT: SDL_KEYUP (timestamp=535038 windowid=1 state=released repeat=false scancode=57 keycode=1073741881 mod=0)

If I press CTRL and d, I can walk and the log says:

Code: Select all

INFO: SDL EVENT: SDL_KEYDOWN (timestamp=476609 windowid=1 state=pressed repeat=false scancode=224 keycode=1073742048 mod=64)
INFO: SDL EVENT: SDL_KEYDOWN (timestamp=477076 windowid=1 state=pressed repeat=false scancode=7 keycode=100 mod=64)
INFO: SDL EVENT: SDL_KEYUP (timestamp=477427 windowid=1 state=released repeat=false scancode=7 keycode=100 mod=64)
INFO: SDL EVENT: SDL_KEYUP (timestamp=477713 windowid=1 state=released repeat=false scancode=224 keycode=1073742048 mod=0)

Re: [raiguard][2.0.7][Linux][wayland] Videodriver set to wayland --> Keyboard doesnt work

Posted: Thu Oct 24, 2024 4:29 pm
by raiguard
If SDL is not receiving the correct keyboard events then there isn't really anything I can do.

This looks like something wacky in your keyboard configuration. Perhaps updating SDL (which we plan to do in the relatively near future) will fix it, but beyond that you're on your own. I'm sorry.

Re: [raiguard][2.0.7][Linux][wayland] Videodriver set to wayland --> Keyboard doesnt work

Posted: Mon Oct 28, 2024 3:39 pm
by daaaana
I was also encountering this issue, and managed to find a workaround. I'm also using KDE plasma on Wayland, and in my case, the root cause was that I had ibus configured as a virtual keyboard. Disabling this setting fixed the issue and allowed me to play the game as expected.
10-28-2024, 11-33-16.png
10-28-2024, 11-33-16.png (83.68 KiB) Viewed 378 times
For reference, here's the software I'm using:

Distro: Arch Linux
Kernel: 6.6.58-1-lts
Desktop environment: KDE Plasma 6.2.2 (running with wayland)
Factorio version: 2.0.11

Re: [raiguard][2.0.7][Linux][wayland] Videodriver set to wayland --> Keyboard doesnt work

Posted: Tue Oct 29, 2024 4:47 pm
by p0lle
nice find! Removing the virtualkeyboard (which KDE suggests to enable via notification), resolved the issue for me, too.

Re: [raiguard][2.0.7][Linux][wayland] Videodriver set to wayland --> Keyboard doesnt work

Posted: Sun Nov 03, 2024 12:01 am
by chayleaf
Can confirm keyboard input doesn't work when you use an IME such as fcitx5.

Re: [raiguard][2.0.7][Linux][wayland] Videodriver set to wayland --> Keyboard doesnt work

Posted: Wed Nov 06, 2024 8:12 pm
by nasa62
Still occurs in 2.0.14, I also had `iBus Wayland` virtual keyboard and setting that to None did fix it, thank you!

Re: [raiguard][2.0.7][Linux][wayland] Videodriver set to wayland --> Keyboard doesnt work

Posted: Fri Nov 08, 2024 7:46 pm
by nasa62
Additional information, still occurs in 2.0.16 after the SDL update listed in that log.

However (tested in both 2.0.15 & .16) the issue only occurs if `IBus Wayland` is enabled *at game startup*.
If you disable IBus Wayland Virtual Keyboard to "None" while the game is running & re-enable it (even without regaining focus on the game) inputs work properly even with it enabled.

So it's just that it has to toggle off... maybe it's reading the Virtual Keyboard first and not trying to read other input devices and when you toggle it it swaps to a different input device and then sticks there?