97033f3f
by Zhiyi Zhang at 2026-01-05T16:38:34+01:00
winex11.drv: Don't send -1 fullscreen monitor indices to window managers.
Fix a regression from 3bea06b8. This partly reverts 6a2e414d, which introduced this bug initially.
With 3bea06b8, it becomes much more likely that indices (-1, -1, -1, -1) got sent to window managers.
This can happen, for example, a game with a 1920x1080 window changes the display resolution to
3840x2160, then changes the window size to 3840x2160. After the resolution change and before the
window size change, xinerama_get_fullscreen_monitors() will return monitor indices (-1, -1, -1, -1)
because 1920x1080 is not fullscreen.
While sending a _NET_WM_FULLSCREEN_MONITORS client message with fullscreen monitor indices
(-1, -1, -1, -1) clears the _NET_WM_FULLSCREEN_MONITORS property for a window on KWin, it can also
make the window to disappear and lose focus. See KWin X11Window::fullscreenMonitorsArea()[1] and
X11Window::updateFullscreenMonitors()[2]. Note that QRect is constructed with an empty rect at the
beginning of X11Window::fullscreenMonitorsArea(). So fullscreen monitor indices (-1, -1, -1, -1)
will produce an empty rect for moveResize() in X11Window::updateFullscreenMonitors() and cause the
window to disappear. While indices (-1, 0, 0, 0) might work, I think it's better not to change
_NET_WM_FULLSCREEN_MONITORS when the window is not fullscreen because removing the property is not
part of any standard.
[1]: https://invent.kde.org/plasma/kwin-x11/-/blob/v6.5.4/src/x11window.cpp?ref_type=tags#L4817
[2]: https://invent.kde.org/plasma/kwin-x11/-/blob/v6.5.4/src/x11window.cpp?ref_type=tags#L4794
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59180