pop-os / cosmic-comp

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

Fix xwm games #603

Open Drakulix opened 3 days ago

Drakulix commented 3 days ago

This seems to fix the majority of minimize-bugs happening with a lot of games. (Where maximizing the window immediately minimizes it again.)

The culprit was the wl_keyboard::leave event, causing the app to register a focus loss, when we switched between KeyboardTarget::Element and KeyboardTarget::Fullscreen. (Confusingly most games seem to unfullscreen themselves before minimizing and restore fullscreen state after unminimizing... causing this weird transition in our code.)

This skips the set of events (thanks to https://github.com/Smithay/smithay/pull/1479), when the new target represents the same surface, which should be fine?!

Dunno, this probably needs some more testing to see, if it doesn't break other apps, but first tests seem promising.

Ref:

Vixea commented 3 days ago

Good news fixes minecraft from my testing bad news it seems all my steam games are broken. :| I'm blaming steam

Drakulix commented 12 hours ago

https://github.com/pop-os/cosmic-comp/issues/434 should now also be fixed

Drakulix commented 12 hours ago

More updates that slightly fix behaviour, but still doesn't restore most windows properly...

Draft until it works completely to not break anything currently working by merging a subset of fixes.

ids1024 commented 10 hours ago

This replace method seems like a nice and simple solution to the leave/enter issue with fullscreening.

Though it does mean that when the WlSurface isn't changed, enter/leave/modifiers also aren't called on the targets that delegate to WlSurface, which could change behavior if they do anything other than call enter/leave/modifiers on the WlSurface.

I think that's not a problem with the current targets, but is something to keep in mind.