Daemon
Daemon copied to clipboard
SDL2 incorrect key behaviour under wayland
OS: OpenSUSE Tumbleweed Desktop environment: SwayWM
I believe this is a bug of SDL2 instead of Daemon, but I hope someone here could identify the bug and file a bug report to the SDL2 repo.
Under wayland (SDL_VIDEODRIVER=wayland
), after switching to other windows and switch back to Unvanquished, the character won't move continuously when I keep pressing a movement key, such as W. Instead, a "key up" event is triggered shortly after the key is pressed.
The problem is fixed under xwayland (SDL_VIDEODRIVER=x11
).
I tried to look into the source but I am not familiar enough with the engine and SDL2 so I cannot locate the exact problem.
Does anyone use wayland on our team?
https://github.com/DaemonEngine/Daemon/blob/bf768da95ade20b80e6fdcb958950597250c7270/src/engine/sys/sdl_input.cpp#L1053
I spent a bit more time on this problem. I think this is the where the issue occurs, SDL_KEYUP
is triggered while I am pressing a key.
Do you think this issue (https://github.com/libsdl-org/SDL/issues/6037) is relevant?
My initial reading of the issue does not seem to imply that its relevant, but I'm not super familiar with SDL2 internals.It certainly does look like an SDL2 issue if you're still holding a key down, but receiving a KEYUP event.
We'll need to follow up with upstream.
I have had problems using Wayland too, I cannot scroll the console with my trackpad under Wayland (but can with xwayland) - the console scrolls up then immediately back down again. This is with kwin, Arch Linux.
I have no problem on Wayland, SDL 2.0.20 and GNOME 42.4. What's your version of SDL?
I have no problem on Wayland, SDL 2.0.20 and GNOME 42.4. What's your version of SDL?
2.24.0
FWIW, the user can only have a different version of SDL2 if they built the game themselves, as we statically link SDL.
FYI, yes I built the game myself.