diff options
| author | srdusr <[email protected]> | 2026-07-27 01:25:00 +0200 |
|---|---|---|
| committer | srdusr <[email protected]> | 2026-07-27 01:25:00 +0200 |
| commit | e20d49b0ee3dbd83499445d61eb2d65904d74311 (patch) | |
| tree | bec0d976da83c17fef7a68033e4d2b66394421c1 /crates/wayland/src/protocols/compositor.rs | |
| parent | 48ccac7ecaeff0aaa503804bdf8e033e273b9862 (diff) | |
| download | srdwm-e20d49b0ee3dbd83499445d61eb2d65904d74311.tar.gz srdwm-e20d49b0ee3dbd83499445d61eb2d65904d74311.zip | |
Hide a window only when srdwm knows it has not drawn, not when a lookup says so
Regression I introduced two commits ago, reported live: "I can click close
where the button would normally be and it does close, but it is still
invisible."
The gate that stops an empty frame being drawn before a client paints asked
the renderer, from inside the render loop, whether a window's surface had a
buffer attached right now - and treated "no" as "do not draw". That
question is only meaningful for a native xdg-shell toplevel. An XWayland
window's surface state does not describe it the same way, so the answer came
back no on every frame and the window was never drawn again, while srdwm's
own hit-testing carried on working perfectly: an invisible window that still
takes clicks, which is a worse failure than the empty frame it was meant to
prevent.
Inverted to the fail-safe direction. `new_managed_window` - the one path
that creates a native toplevel - puts the window into
`awaiting_first_buffer`, and `commit` takes it out on the first commit that
carries a buffer. The render and capture paths test that set and nothing
else. A window is now hidden only when srdwm itself put it there, so no
window whose plumbing works differently can be hidden by a lookup that did
not apply to it: the XWayland map path never touches the set, and neither
can anything else.
The buffer question still gets asked, but only in `commit`, about a surface
it was just handed, where it is the right question.
Verified both halves: an ordinary spawn still shows no frame before content
(26 captured frames with content, 0 without), and the only way into the set
is one line in one function.
Diffstat (limited to 'crates/wayland/src/protocols/compositor.rs')
| -rw-r--r-- | crates/wayland/src/protocols/compositor.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/wayland/src/protocols/compositor.rs b/crates/wayland/src/protocols/compositor.rs index 7be5d7e..cf5a048 100644 --- a/crates/wayland/src/protocols/compositor.rs +++ b/crates/wayland/src/protocols/compositor.rs @@ -91,14 +91,14 @@ impl CompositorHandler for CompState { // against the guessed placeholder for one more round-trip. // The first commit that actually carries a buffer is when this // window becomes visible, so it is also when the open-slide - // should start - see `windows_shown_once`. Registered here + // should start - see `awaiting_first_buffer`. Registered here // rather than in `new_managed_window` because a role is created // well before a client paints (measured at ~800ms for a cold // terminal), which is long enough for the whole tween to finish // against an empty frame and for the window to simply appear, // already at rest, with no animation at all. - if !self.windows_shown_once.contains(&id) && self.window_has_content(id) { - self.windows_shown_once.insert(id); + if self.awaiting_first_buffer.contains(&id) && self.surface_has_buffer(id) { + self.awaiting_first_buffer.remove(&id); let mut wm = self.wm.borrow_mut(); if wm.animations_enabled { if let Some(win) = wm.window_mut(id) { |