xwayland(swaywm): mouse wasn't grabbed by window (broken mouse look)
Mouse movement is not relevant to camera movement. Cursor isn't hiding. Seems the mouse wasn't grabbed by the window. See video.
It can be fixed by switching to the windowed mode and back to the fullscreen mode by window manager hotkeys.
https://github.com/user-attachments/assets/c9aa3755-cd88-48e0-b768-fb7e8b649872
Hi @telychko and thanks for raising!
Seems the mouse wasn't grabbed by the window
There is no true grab, but reposition of cursor, when game is in full screen. And naturally full-screen check is very tricky in Linux. Can you point me do what distributive is that, so I might give it a go in VirtualBox? Thanks!
Thank you for the reply. I'm testing on Arch Linux distro. I can build project locally, so if you give a clue where to investigate, I can take a look on a weekend. Thank you.
$ Xwayland -version
The X.Org Foundation Xwayland Version 24.1.6 (12401006)
X Protocol Version 11, Revision 0
$ sway --version
sway version 1.10.1
$ uname -a
Linux inspiron 6.12.19-1-lts #1 SMP PREEMPT_DYNAMIC Thu, 13 Mar 2025 15:20:33 +0000 x86_64 GNU/Linux
I can build project locally, so if you give a clue where to investigate
Sure!
Linux related code is located in OpenGothic/lib/Tempest/Engine/system/api/x11api.cpp. For full-screen check there is:
-
implIsFullscreen- check used by application (simply fetches from lookup-table) -
nativeIsFullscreen- actual check, implemented via X11 api
It can be fixed by switching to the windowed mode and back to the fullscreen
Possibly, after window was created at implCreateWindow, full-screen check didn't work as expected.
Also note: you can toggle full-screen on/off, in marvin mode via F3 - this can be convenient testing
I've took a look on this piece of code. Your assumption was right. It creates a window and checks the fullscreen status. Check for fullscreen immediately after window is created, returns false because there no properties yet. GetWindowProperty returns zero numItems.
I've tried add window to fullscreen window list unconditionally, but nothing changed.
Problem is fixed by toggling fullscreen, so it happened somewhere here. Looks like resize fixes the problem, but probably, resize is called before window is fully created. I mean, probably, window is not fully created at the time when X11Api::alignGeometry called.
Check for fullscreen immediately after window is created, returns false because there no properties yet.
In this place it's somewhat expected - this is only to check if window was already in full-screen. Actual toggle happens after.
Once full-screen is requested, application can expect to receive PropertyNotify event. I would assume that there is nothing to do with resize, but X11 failed to notify application of state change.
I've tried add window to fullscreen window list unconditionally
Can you check if hard-coding implIsFullscreen to call directly nativeIsFullscreen (and thus not relay on cached state) fixes the issue?