kms: change from thread_local approach to wiring scanout node through function calls to detect scanout candidates

This commit is contained in:
Ericky Dos Santos 2026-07-01 11:05:56 -04:00 committed by Jacob Kauffmann
parent 012c77ec81
commit 031fdc389a
12 changed files with 140 additions and 68 deletions

View file

@ -475,6 +475,7 @@ pub fn cursor_elements<'a, 'frame, R>(
output: &Output,
mode: CursorMode,
exclude_dnd_icon: bool,
scanout_node: Option<DrmNode>,
) -> Vec<CosmicElement<R>>
where
R: AsGlowRenderer,
@ -549,7 +550,14 @@ where
.lock()
.unwrap()
.as_ref()
.map(|state| state.render::<CosmicMappedRenderElement<R>, R>(renderer, output, theme))
.map(|state| {
state.render::<CosmicMappedRenderElement<R>, R>(
renderer,
output,
theme,
scanout_node,
)
})
{
elements.extend(grab_elements.into_iter().map(|elem| {
CosmicElement::MoveGrab(RescaleRenderElement::from_element(
@ -615,6 +623,7 @@ pub fn output_elements<R>(
output: &Output,
cursor_mode: CursorMode,
_fps: Option<(&EguiState, &Timings)>,
scanout_node: Option<DrmNode>,
) -> Result<Vec<CosmicElement<R>>, RenderError<R::Error>>
where
R: AsGlowRenderer,
@ -690,6 +699,7 @@ where
workspace,
cursor_mode,
element_filter,
scanout_node,
)?;
#[cfg(feature = "debug")]
@ -713,6 +723,7 @@ pub fn workspace_elements<R>(
current: (WorkspaceHandle, usize),
cursor_mode: CursorMode,
element_filter: ElementFilter,
scanout_node: Option<DrmNode>,
) -> Result<Vec<CosmicElement<R>>, RenderError<R::Error>>
where
R: AsGlowRenderer,
@ -743,6 +754,7 @@ where
output,
cursor_mode,
element_filter == ElementFilter::ExcludeWorkspaceOverview,
scanout_node,
));
let shell = shell.read();
@ -907,7 +919,7 @@ where
elements.extend(
layout
.render_popups(renderer, alpha)
.render_popups(renderer, alpha, scanout_node)
.into_iter()
.map(Into::into)
.flat_map(crop_to_output)
@ -951,6 +963,7 @@ where
active_hint,
alpha,
theme.cosmic(),
scanout_node,
)
.into_iter()
.map(Into::into)
@ -966,6 +979,7 @@ where
!move_active && is_active_space,
overview.clone(),
theme.cosmic(),
scanout_node,
) {
Ok(elements) => {
elements
@ -995,6 +1009,7 @@ where
resize_indicator.clone(),
active_hint,
theme.cosmic(),
scanout_node,
) {
Ok(elements) => {
elements
@ -1511,6 +1526,7 @@ where
current,
cursor_mode,
element_filter,
None,
)?;
if let Some(additional_damage) = additional_damage {