mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-18 06:38:38 +01:00
feat(kwin): survive KWin restarting
KWin can go away under a running daemon while the session bus stays: it crashed, or kwin_wayland --replace took its place. Its windows go with it, and so does the bridge, which would have reported them closing; in the spikes the old windows vanished without a single removed event. What the daemon does see is the bus, so the thread that serves the connection watches NameOwnerChanged for org.kde.KWin. When the name loses its owner, Table::compositor_lost marks every window closed and returns a Destroy for each, so the window manager takes them out of its layout, and their ids are not given out again. When the name has an owner again, the daemon loads the bridge into the new KWin, trying for up to 15 seconds while KWin is not ready for it, and the bridge reports the new desktop in a snapshot. zbus does not end a held call when its caller leaves the bus, so the Poll of the old bridge is still waiting when the new bridge calls, and it was woken first: it took the commands for the new KWin and answered them to nobody. vm-kwin-restart lost the tile of a window opened in the third KWin that way in one run of three, and a recording of the bus showed the batch going to the old bridge. A Poll held since before KWin last left the bus is answered with nothing and passes its wake-up on to the next call, which a unit test holds. The VM suite vm-kwin-restart (from the spike's spike7-resync) restarts the headless KWin twice under a running daemon, through Kde.restart_kwin in the VM library, and checks that the daemon sees KWin go, takes the old windows out of its layout, loads the bridge into the new KWin, and tiles the windows that open there.
This commit is contained in:
1 parent
b463191d00
commit
4386003e30
13 files changed
+380
-12
No files matched your search
@@ -143,3 +143,15 @@ to the middle of the focused window, for two different windows. The backend asks
|
||||
KWin reports the window it focused as active, so the action finds the right one. The cost is
|
||||
that the pointer can go to the middle of the focused window and nowhere else, which is what
|
||||
komorebi asks for.
|
||||
|
||||
## Why does komorebi take every window out of its layout when KWin leaves the session bus?
|
||||
|
||||
Because nothing else will say that they have gone. When KWin goes away under a running
|
||||
session (it crashed, or another KWin replaced it), its clients lose their connection and
|
||||
their windows go with it, and so does the bridge, which would have reported them closing. In
|
||||
the spikes KWin was killed and started again under a running daemon on the same bus, twice:
|
||||
the old windows vanished without a single `removed` event. What the daemon does see is the
|
||||
bus itself: `NameOwnerChanged` says that `org.kde.KWin` has lost its owner, and later that it
|
||||
has a new one. So losing the name counts as every window closing, and getting it back as the
|
||||
moment to load the bridge into the new KWin, which then reports its desktop as it does at
|
||||
start.
|
||||
Reference in new issue
Block a user