render: Use NamespaceElements to fix blurred lower layer-shell surfaces

This commit is contained in:
Victoria Brekenfeld 2026-03-06 17:19:12 +01:00 • committed by Victoria Brekenfeld
parent a9bf89d8b2
commit eb41b076ed
6 changed files with 134 additions and 45 deletions

View file

@ -939,19 +939,22 @@ impl Common {
render_element_states: &RenderElementStates,
) {
let shell = self.shell.read();
let processor = |surface: &WlSurface, states: &SurfaceData| {
let primary_scanout_output = update_surface_primary_scanout_output(
surface,
output,
states,
None,
render_element_states,
primary_scanout_output_compare,
);
if let Some(output) = primary_scanout_output {
with_fractional_scale(states, |fraction_scale| {
fraction_scale.set_preferred_scale(output.current_scale().fractional_scale());
});
let processor = |namespace: Option<usize>| {
move |surface: &WlSurface, states: &SurfaceData| {
let primary_scanout_output = update_surface_primary_scanout_output(
surface,
output,
states,
namespace,
render_element_states,
primary_scanout_output_compare,
);
if let Some(output) = primary_scanout_output {
with_fractional_scale(states, |fraction_scale| {
fraction_scale
.set_preferred_scale(output.current_scale().fractional_scale());
});
}
}
};
@ -959,7 +962,7 @@ impl Common {
if let Some(session_lock) = shell.session_lock.as_ref()
&& let Some(lock_surface) = session_lock.surfaces.get(output)
{
with_surfaces_surface_tree(lock_surface.wl_surface(), processor)
with_surfaces_surface_tree(lock_surface.wl_surface(), processor(None))
}
for seat in shell
@ -971,7 +974,7 @@ impl Common {
// cursor ...
if let CursorImageStatus::Surface(wl_surface) = cursor_status {
with_surfaces_surface_tree(&wl_surface, processor);
with_surfaces_surface_tree(&wl_surface, processor(None));
}
// grabs
@ -979,12 +982,12 @@ impl Common {
&& let Some(grab_state) = move_grab.lock().unwrap().as_ref()
{
for (window, _) in grab_state.element().windows() {
window.with_surfaces(processor);
window.with_surfaces(processor(None));
}
}
if let Some(icon) = get_dnd_icon(seat) {
with_surfaces_surface_tree(&icon.surface, processor);
with_surfaces_surface_tree(&icon.surface, processor(None));
}
}
@ -992,7 +995,7 @@ impl Common {
for set in shell.workspaces.sets.values() {
set.sticky_layer.mapped().for_each(|mapped| {
for (window, _) in mapped.windows() {
window.with_surfaces(processor);
window.with_surfaces(processor(None));
}
});
}
@ -1000,16 +1003,16 @@ impl Common {
// normal windows
for space in shell.workspaces.spaces() {
if let Some(fs) = space.get_fullscreen(shell.seats.last_active()) {
fs.surface.with_surfaces(processor);
fs.surface.with_surfaces(processor(None));
}
space.mapped().for_each(|mapped| {
for (window, _) in mapped.windows() {
window.with_surfaces(processor);
window.with_surfaces(processor(None));
}
});
space.minimized_windows.iter().for_each(|m| {
for window in m.windows() {
window.with_surfaces(processor);
window.with_surfaces(processor(None));
}
})
}
@ -1017,15 +1020,16 @@ impl Common {
// OR windows
shell.override_redirect_windows.iter().for_each(|or| {
if let Some(wl_surface) = or.wl_surface() {
with_surfaces_surface_tree(&wl_surface, processor);
with_surfaces_surface_tree(&wl_surface, processor(None));
}
});
// layer surfaces
for o in shell.outputs() {
let namespace = shell.workspaces.active_num(o).1;
let map = smithay::desktop::layer_map_for_output(o);
for layer_surface in map.layers() {
layer_surface.with_surfaces(processor);
layer_surface.with_surfaces(processor(Some(namespace)));
}
}
}