fix: keep windows visible until overview commits a buffer

This commit is contained in:
Frederic Laing 2026-06-26 16:08:59 +02:00 committed by Victoria Brekenfeld
parent aac1e19f08
commit 650768211f

View file

@ -1,6 +1,9 @@
// SPDX-License-Identifier: GPL-3.0-only // SPDX-License-Identifier: GPL-3.0-only
use smithay::{desktop::layer_map_for_output, output::Output}; use smithay::{
backend::renderer::utils::with_renderer_surface_state, desktop::layer_map_for_output,
output::Output,
};
/// Layer shell namespace used by `cosmic-workspaces` /// Layer shell namespace used by `cosmic-workspaces`
// TODO: Avoid special case, or add protocol to expose required behavior // TODO: Avoid special case, or add protocol to expose required behavior
@ -10,5 +13,14 @@ pub const WORKSPACE_OVERVIEW_NAMESPACE: &str = "cosmic-workspace-overview";
pub fn workspace_overview_is_open(output: &Output) -> bool { pub fn workspace_overview_is_open(output: &Output) -> bool {
layer_map_for_output(output) layer_map_for_output(output)
.layers() .layers()
.any(|s| s.namespace() == WORKSPACE_OVERVIEW_NAMESPACE) .filter(|s| s.namespace() == WORKSPACE_OVERVIEW_NAMESPACE)
// Only consider the overview open once it has committed a buffer. The
// surface is inserted into the layer map on its initial (bufferless)
// commit, so checking for the namespace alone hides all toplevels for a
// frame before the overview has anything to draw, briefly flashing the
// bare wallpaper.
.any(|s| {
with_renderer_surface_state(s.wl_surface(), |state| state.buffer().is_some())
.unwrap_or(false)
})
} }