layout/tiling: Resize shadows to fit scaled windows

This commit is contained in:
Victoria Brekenfeld 2025-12-16 18:48:40 +01:00 committed by Victoria Brekenfeld
parent 23e1bae96e
commit 6d0f1b273f
6 changed files with 57 additions and 44 deletions

View file

@ -596,7 +596,8 @@ impl CosmicMapped {
&self,
renderer: &mut R,
location: smithay::utils::Point<i32, smithay::utils::Physical>,
scale: smithay::utils::Scale<f64>,
output_scale: smithay::utils::Scale<f64>,
scale: f64,
alpha: f32,
) -> Option<C>
where
@ -608,12 +609,20 @@ impl CosmicMapped {
match &self.element {
CosmicMappedInternal::Stack(s) => s
.shadow_render_element::<R, CosmicMappedRenderElement<R>>(
renderer, location, scale, alpha,
renderer,
location,
output_scale,
scale,
alpha,
)
.map(Into::into),
CosmicMappedInternal::Window(w) => w
.shadow_render_element::<R, CosmicMappedRenderElement<R>>(
renderer, location, scale, alpha,
renderer,
location,
output_scale,
scale,
alpha,
)
.map(Into::into),
_ => unreachable!(),

View file

@ -660,7 +660,8 @@ impl CosmicStack {
&self,
renderer: &mut R,
location: Point<i32, Physical>,
scale: Scale<f64>,
output_scale: Scale<f64>,
scale: f64,
alpha: f32,
) -> Option<C>
where
@ -690,13 +691,14 @@ impl CosmicStack {
.cosmic()
.radius_s()
.map(|x| if x < 4.0 { x } else { x + 4.0 })
.map(|x| x.round() as u8)
.map(|x| (x * scale as f32).round() as u8)
})
.unwrap_or([0, 0, 0, 0]);
let mut geo = SpaceElement::geometry(&windows[active]).to_f64();
geo.loc += location.to_f64().to_logical(scale);
geo.size.h += TAB_HEIGHT as f64;
geo = geo.upscale(scale);
geo.loc += location.to_f64().to_logical(output_scale);
let window_key =
CosmicMappedKey(CosmicMappedKeyInner::Stack(Arc::downgrade(&self.0.0)));
@ -708,7 +710,7 @@ impl CosmicStack {
geo.to_i32_round().as_local(),
radii,
if activated { alpha } else { alpha * 0.75 },
scale.x,
output_scale.x,
))
.into(),
)

View file

@ -358,7 +358,8 @@ impl CosmicWindow {
&self,
renderer: &mut R,
location: Point<i32, Physical>,
scale: Scale<f64>,
output_scale: Scale<f64>,
scale: f64,
alpha: f32,
) -> Option<C>
where
@ -394,7 +395,7 @@ impl CosmicWindow {
.cosmic()
.radius_s()
.map(|x| if x < 4.0 { x } else { x + 4.0 })
.map(|x| x.round() as u8);
.map(|x| (x * scale as f32).round() as u8);
if has_ssd && !clip {
// bottom corners
radii[0] = 0;
@ -407,10 +408,11 @@ impl CosmicWindow {
}
let mut geo = SpaceElement::geometry(&p.window).to_f64();
geo.loc += location.to_f64().to_logical(scale);
if has_ssd {
geo.size.h += SSD_HEIGHT as f64;
}
geo = geo.upscale(scale);
geo.loc += location.to_f64().to_logical(output_scale);
let window_key =
CosmicMappedKey(CosmicMappedKeyInner::Window(Arc::downgrade(&self.0.0)));
@ -422,7 +424,7 @@ impl CosmicWindow {
geo.to_i32_round().as_local(),
radii,
if activated { alpha } else { alpha * 0.75 },
scale.x,
output_scale.x,
))
.into(),
)