fix: hold the DVD cover until the disc menu is actually showing

The readiness condition was playback state alone, and on a real disc
VLC reports playing well before its window has taken the screen. The
cover came off onto VLC's ordinary tiled startup window — black, sized
to everything except the dock's reserved strip — and the disc menu only
arrived afterwards. Exactly the state the cover exists to hide.

Ask sway instead. VLC only takes the display when its window goes
fullscreen, and the tree says when that happens. The cover now comes off
when VLC reports playing or paused, its window is fullscreen, and 800ms
have passed for the menu to draw its first frames. The playback check
runs first because it is local and cheap; the tree is only walked once
VLC claims to be playing something.

The twenty second deadline is unchanged: a cover with nothing behind it
is still the one outcome DVD mode must never produce.

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
ekklesia
2026-09-04 23:17:37 -05:00
co-authored by Claude Opus 5
parent 719b856040
commit 37f8166401
3 changed files with 157 additions and 24 deletions
+16 -4
View File
@@ -64,10 +64,22 @@ dock is a top-layer surface and DVD mode has to cover it. Its exclusive
zone is `-1`, which tells sway not to move it out of the way of the
strip the dock reserves.
It comes down when VLC reports playing or paused, meaning the video
output exists and has taken the display, plus a moment for the handover.
A twenty second deadline takes it down regardless: a cover with nothing
behind it is the one outcome DVD mode must never produce.
It comes down only when **all three** of these hold:
1. VLC reports playing or paused, and
2. VLC's window is fullscreen in the sway tree, and
3. 800ms have passed since both became true.
Playback state alone is not enough, and used to be the whole condition.
VLC reports playing while its window is still the ordinary tiled one
sway gave it — which is exactly the black startup window the cover
exists to hide. It only takes the display when it goes fullscreen, and
the sway tree is what says so. The final hold gives the disc menu time
to draw its first frames, so the handover lands on the menu rather than
on VLC's black.
A twenty second deadline takes the cover down regardless: a cover with
nothing behind it is the one outcome DVD mode must never produce.
VLC is still the backend because its `dvdnav` module is what decodes
disc menus, and nothing else on Debian does that reliably. But nothing