When cosmic-workspaces is shown, render only layer-shell surfaces

This allows `cosmic-workspaces` to rely on cosmic-comp for rendering the
background, and just have transparency. This should be a more reliable
and performant way of doing things, at least for now.

Instead of adding another opaque bool argument, this defines an
`ElementFilter` enum, which makes calls more readable.

Window surfaces are still included in screencopy, as needed for the
workspace previews.
This commit is contained in:
Ian Douglas Scott 2024-07-09 20:46:41 -07:00 committed by Victoria Brekenfeld
parent 31358d1993
commit 355b142c52
3 changed files with 83 additions and 60 deletions

View file

@ -3,13 +3,15 @@
use crate::{
backend::render::{
element::{CosmicElement, DamageElement},
init_shaders, workspace_elements, CursorMode, GlMultiRenderer, CLEAR_COLOR,
init_shaders, workspace_elements, CursorMode, ElementFilter, GlMultiRenderer, CLEAR_COLOR,
},
shell::Shell,
state::SurfaceDmabufFeedback,
utils::prelude::*,
wayland::{
handlers::screencopy::{submit_buffer, FrameHolder, SessionData},
handlers::screencopy::{
submit_buffer, FrameHolder, SessionData, WORKSPACE_OVERVIEW_NAMESPACE,
},
protocols::screencopy::{
FailureReason, Frame as ScreencopyFrame, Session as ScreencopySession,
},
@ -46,7 +48,7 @@ use smithay::{
Bind, ImportDma, Offscreen, Renderer, Texture,
},
},
desktop::utils::OutputPresentationFeedback,
desktop::{layer_map_for_output, utils::OutputPresentationFeedback},
output::{Output, OutputNoMode},
reexports::{
calloop::{
@ -869,6 +871,15 @@ impl SurfaceThreadState {
std::mem::drop(shell);
let element_filter = if layer_map_for_output(output)
.layers()
.any(|s| s.namespace() == WORKSPACE_OVERVIEW_NAMESPACE)
{
ElementFilter::LayerShellOnly
} else {
ElementFilter::All
};
workspace_elements(
Some(&render_node),
&mut renderer,
@ -878,7 +889,7 @@ impl SurfaceThreadState {
previous_workspace,
workspace,
CursorMode::All,
false,
element_filter,
#[cfg(not(feature = "debug"))]
None,
#[cfg(feature = "debug")]