I know we've had a policy to avoid window manager specific workarounds, I think we could reconsider it. The fix could be unguarded and applied with every window manager, and could very well work, but I think it is ugly enough to justify checking for KWin specifically.
The problem is that as soon as a window configure request is sent to a maximized window, KWin internal state gets bogus and it loses track of the window maximized state. I've described the KWin source details on https://bugs.kde.org/show_bug.cgi?id=496966 and opened https://invent.kde.org/plasma/kwin/-/merge_requests/6854 as a possible fix for it, but the time it will take to land could justify working around it in Wine.
The workaround is to avoid sending configure requests to maximized windows, which sounds sensible and we already avoid resizing maximized windows, but, moving a maximized window to a different monitor *requires* sending a configure request. KWin bug makes no difference to requests with only position changes, and they trigger it all the same. So, the only solution is to temporarily remove the maximized state bits before sending the configure request, putting them back afterwards. This is quite straightforward to do with the new state tracker, but it could very well trigger other problems with other window managers.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57465
-- v4: winex11: Workaround KWin bug with maximized windows. winex11: Set _NET_WM_USER_TIME to 0 to implement SWP_NOACTIVATE. winex11: Keep track of the SWP flags to be used when mapping windows. winex11: Keep _NET_WM_USER_TIME on the individual windows. winex11: Workaround Mutter bug when changing decorations. winex11: Avoid creating windows with override-redirect flag set. winex11: Track _MOTIF_WM_HINTS property in the state tracker. winex11: Introduce a new handle_state_change helper. winex11: Ignore transient state changes in other processes. winex11: Give focus to the expected window when unampping with focus. winex11: Use the current state when deciding how to reply to WM_TAKE_FOCUS. winex11: Use the state tracker for the desktop window _NET_WM_STATE. win32u: Use the winstation monitor update serial to detect updates. server: Add a winstation monitor update serial counter. win32u: Extend display_lock CS around winstation check. win32u: Release the Win16 mutex when yielding in peek_message. win32u: Skip updating the cache on driver load if we're already updating it.
This merge request has too many patches to be relayed via email. Please visit the URL below to see the contents of the merge request. https://gitlab.winehq.org/wine/wine/-/merge_requests/6944