element: Clip to tile size if available instead of element geometry

This commit is contained in:
Victoria Brekenfeld 2025-12-22 18:26:20 +01:00 committed by Victoria Brekenfeld
parent 8f7dc7f00c
commit e4e7567174
6 changed files with 31 additions and 0 deletions

View file

@ -660,6 +660,7 @@ impl CosmicStack {
&self,
renderer: &mut R,
location: Point<i32, Physical>,
max_size: Option<Size<i32, Logical>>,
output_scale: Scale<f64>,
scale: f64,
alpha: f32,
@ -697,6 +698,10 @@ impl CosmicStack {
let mut geo = SpaceElement::geometry(&windows[active]).to_f64();
geo.size.h += TAB_HEIGHT as f64;
if let Some(max_size) = max_size {
geo.size = geo.size.clamp(Size::default(), max_size.to_f64());
}
geo = geo.upscale(scale);
geo.loc += location.to_f64().to_logical(output_scale);
@ -722,6 +727,7 @@ impl CosmicStack {
&self,
renderer: &mut R,
location: Point<i32, Physical>,
max_size: Option<Size<i32, Logical>>,
scale: Scale<f64>,
alpha: f32,
scanout_override: Option<bool>,
@ -769,6 +775,9 @@ impl CosmicStack {
let mut geo = SpaceElement::geometry(&windows[active]).to_f64();
geo.loc += location.to_f64().to_logical(scale);
geo.size.h += TAB_HEIGHT as f64;
if let Some(max_size) = max_size {
geo.size = geo.size.clamp(Size::default(), max_size.to_f64());
}
let window_key =
CosmicMappedKey(CosmicMappedKeyInner::Stack(Arc::downgrade(&self.0.0)));