Bug 504321

Summary: "Exclusive" fullscreen Wine games freeze after Alt+Tab → refocusing
Product: [Plasma] kwin Reporter: fililip <team>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: nate, pollux66, team
Priority: NOR Keywords: regression
Version First Reported In: 6.3.90   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 6.4.0
Sentry Crash Report:

Description fililip 2025-05-16 09:41:27 UTC
SUMMARY
When alt-tabbing out of a Wine game in fullscreen mode, the game auto-minimizes. Upon trying to re-focus its window, it gets brought back but displays a freeze frame and does not update anymore.

This does not happen on Plasma/6.3; everything works as expected prior to 6.4.
It also does not happen with the Wayland driver for Wine.

STEPS TO REPRODUCE
1. Launch a Wine game (I tested both Black Mesa using Proton and Doom 2016)
2. Alt+Tab out of it
3. Attempt to return to it

OBSERVED RESULT
The game freezes

EXPECTED RESULT
The game continues running normally

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.3.90
KDE Frameworks Version: 6.14.0
Qt Version: 6.9.0
Kernel Version: 6.14.6-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 20 × AMD Ryzen AI 9 365 w/ Radeon 880M
Memory: 32 GiB of RAM (27.2 GiB usable)
Graphics Processor: AMD Radeon Graphics
Comment 1 fililip 2025-05-16 19:55:56 UTC
Bisected to:

0b6decb103b01187d7665cc9942687df1f1ff22f is the first bad commit
commit 0b6decb103b01187d7665cc9942687df1f1ff22f
Author: Xaver Hugl <xaver.hugl@gmail.com>
Date:   Wed Jan 1 22:26:25 2025 +0100

    remove the x11 operation mode, and the x11 standalone backend
Comment 2 Bug Janitor Service 2025-05-17 12:28:16 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/7623
Comment 3 Vlad Zahorodnii 2025-05-17 12:49:31 UTC
Git commit ba13665e9ea72da5e52c8d486dc97c9e987498c1 by Vlad Zahorodnii.
Committed on 17/05/2025 at 12:49.
Pushed by vladz into branch 'master'.

Properly unmap minimized and hidden X11 windows

Amends 0b6decb103b01187d7665cc9942687df1f1ff22f.

This is what kwin used to do prior to the split. Video games probably
break because they monitor UnmapNotify events, and with internalKeep()
they never arrive.

M  +2    -2    src/x11window.cpp

https://invent.kde.org/plasma/kwin/-/commit/ba13665e9ea72da5e52c8d486dc97c9e987498c1
Comment 4 Vlad Zahorodnii 2025-05-17 12:51:11 UTC
Git commit a49dc8e4e7a11677f22d08247a4cb015cee210bd by Vlad Zahorodnii.
Committed on 17/05/2025 at 12:50.
Pushed by vladz into branch 'Plasma/6.4'.

Properly unmap minimized and hidden X11 windows

Amends 0b6decb103b01187d7665cc9942687df1f1ff22f.

This is what kwin used to do prior to the split. Video games probably
break because they monitor UnmapNotify events, and with internalKeep()
they never arrive.

(cherry picked from commit ba13665e9ea72da5e52c8d486dc97c9e987498c1)

M  +2    -2    src/x11window.cpp

https://invent.kde.org/plasma/kwin/-/commit/a49dc8e4e7a11677f22d08247a4cb015cee210bd
Comment 5 Vlad Zahorodnii 2025-05-20 08:55:28 UTC
*** Bug 504555 has been marked as a duplicate of this bug. ***
Comment 6 Bug Janitor Service 2025-10-13 07:05:52 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/8238
Comment 7 Vlad Zahorodnii 2025-10-14 14:46:52 UTC
Git commit f25e605d830072f1f6ee4a9c1006f182e227d4df by Vlad Zahorodnii.
Committed on 14/10/2025 at 14:14.
Pushed by vladz into branch 'Plasma/6.5'.

x11: Restore "kept" window state

Effectively reverts c8efb221b361a0100e93797383ffa51e963d0166.

Video games are susceptible to the kept window state. If a video game is
put behind other windows, it will eventually break and it may not recover
from the broken state after it is made visible. The likely reason why
video games break is due to frame callback starvation.

c8efb221b361a0100e93797383ffa51e963d0166 attempted to address that issue
by unmapping the windows. However, it made X11 windows flash when
switching between virtual desktops or activities using a touchpad.
When a window is mapped, Xwayland will immediately destroy and create a
new wl_surface.

For the time being, this change brings back the old behavior so 6.5 still
has the same behavior as 6.4 and we have more time to figure out what to
do for 6.6.

M  +16   -2    src/layers.cpp
M  +10   -0    src/workspace.cpp
M  +9    -0    src/workspace.h
M  +25   -3    src/x11window.cpp
M  +8    -0    src/x11window.h

https://invent.kde.org/plasma/kwin/-/commit/f25e605d830072f1f6ee4a9c1006f182e227d4df