pop-os / cosmic-comp

Compositor for the COSMIC desktop environment
GNU General Public License v3.0
418 stars 51 forks source link

Fullscreen games running in xwayland become non-functional once focus is lost #475

Open Dekomoro opened 1 month ago

Dekomoro commented 1 month ago

This includes freezing, black screens, other artifacts.

Tested with various games that I've found to work with Wayland and X11(using the SDL_VIDEODRIVER variable) including Terraria, Factorio, and Team Fortress 2. Wine games seem to always exhibit this behavior including ones that lose focus on launch.

Typically is gauranteed to happen if you move your mouse off the fullscreen game onto another monitor.

Seems related to https://github.com/pop-os/cosmic-comp/issues/442 and https://github.com/pop-os/cosmic-comp/issues/460

ids1024 commented 1 month ago

This could be related to https://github.com/pop-os/cosmic-comp/issues/231. I fixed one issue related to that, but there seem to be more problems.

For Linux-native SDL games, does setting SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=0 help here?

Dekomoro commented 1 month ago

It appears it does

Dekomoro commented 1 month ago

It definitely seems to be related to fullscreen apps minimizing. Which happens to function when wayland apps do it.

Dekomoro commented 1 month ago

Also happens both in tiling and floating modes if that info helps

ids1024 commented 1 month ago

Hm, odd that disabling SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS doesn't help, since I've seen that help.

We have several issues with Xwayland still. There's a lot of subtle details in getting the X window manager logic to play along with all clients.

Dekomoro commented 1 month ago

Testing on Arch Linux it exhibits different behavior, Terraria freezes on focus lost with SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS set to 0, but crashes if it's set to 1

onlyreportingissues commented 1 month ago

This might be useful: https://github.com/labwc/labwc/pull/960

"view: add minimize method and call wlr_xwayland_surface_set_minimized() for xwayland surfaces on (un)minimize"

(Jun 25, 2023)

Dekomoro commented 1 month ago

Testing on Arch Linux it exhibits different behavior, Terraria freezes on focus lost with SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS set to 0, but crashes if it's set to 1

Apparently the crashing was just an issue with the game, games just freeze in fullscreen in general now, but not in borderless windowed

Dekomoro commented 1 month ago

xwayland in rootful fullscreen does not appear to exhibit this issue

Dekomoro commented 1 month ago

I happened to use xwayland-run to attempt this which technically spawns a new xwayland instance with arguments I choose. I just use the arguments -fullscreen -geometry 1920x1080

Dekomoro commented 1 month ago

github is weird and my message dissappeared but it does seem to be related to, as my issues only appear to happen when direct scan out is triggered. https://github.com/Smithay/smithay/issues/1336