Rendering issue with _NET_WM_STATE_FULLSCREEN plus _NET_WM_BYPASS_COMPOSITOR
Affected version
- I can reproduce issue on Gnome/x11 on Ubuntu 22.04/x86-64 (both with an Intel GPU and Nvidia's drivers)
- Others have reported it to me on Manjaro and Pop!OS, so it's likely not distro-specific.
- I have reproduced this Gnome 42.2, but I have seen this on a Ubuntu 18.04 install, so it goes back several years.
- This is X11-specific; Wayland (rather, XWayland) does not reproduce.
Bug summary
This is sort of a weird corner case, but it's definitely possible to hit it in an SDL-based game if nothing else.
If you have a window that sets _NET_WM_BYPASS_COMPOSITOR
and goes fullscreen at startup with _NET_WM_STATE_FULLSCREEN
, and later returns to windowed mode by removing _NET_WM_STATE_FULLSCREEN
, the system will fail to update the screen correctly if the no-longer-fullscreen window is moved by the user dragging its titlebar.
In practice it looks something like this:
This was reported as an SDL bug over here, but we have tried to reproduce this on other window managers, and it appears to only happen on Gnome.
Turning off _NET_WM_BYPASS_COMPOSITOR
(or never setting it in the first place) fixes this issue, but once this issue happens, we can't use _NET_WM_BYPASS_COMPOSITOR
again with the window without having the problem, so it isn't a question of toggling it off before changing fullscreen state (or toggling it off and back on to reset the system).
Since SDL does an enormous amount of complex X11 stuff, I have written a minimal reproduction case directly with Xlib to demonstrate the problem (attached). This test program is not a shining example of quality Xlib programming. :)
test_x11_fs_compositor_bypass.c
Steps to reproduce
- Run Gnome on X11, not Wayland (XWayland will not reproduce the issue).
- Download attached test_x11_fs_compositor_bypass.c
gcc -o test_x11_fs_compositor_bypass test_x11_fs_compositor_bypass.c -lX11
- Run test_x11_fs_compositor_bypass. Press any key to go fullscreen, press any key again to go back to windowed mode.
- Once in windowed mode, try dragging the window by its titlebar, and see rendering issue.
- This doesn't always reproduce; it seems to be reliable if you let it sit in fullscreen for a second or two before toggling back to windowed mode. If you toggle too fast, it might not trigger.
- After six key presses, the test program will terminate.
What happened
Window fails to render outside its original position if dragged by user.
What did you expect to happen
Window to continue to be movable around desktop.