fix: support per-corner radius

also adjusts the radius by half of the outline thickness. I believe this is the radius at the center of the outline.
This commit is contained in:
Ashley Wulber 2025-09-24 17:50:23 -04:00 committed by Victoria Brekenfeld
parent b3aa10436a
commit c6320eec0c
5 changed files with 67 additions and 28 deletions

View file

@ -134,12 +134,16 @@ impl MoveGrabState {
let guard = corners.lock().unwrap();
// TODO support multiple radius values
Some(guard.top_left)
Some([
guard.top_right,
guard.bottom_right,
guard.top_left,
guard.bottom_left,
])
})
})
.unwrap_or(self.indicator_thickness);
.unwrap_or([self.indicator_thickness; 4]);
tracing::error!("{radius}");
let focus_element = if self.indicator_thickness > 0 {
Some(
CosmicMappedRenderElement::from(IndicatorShader::focus_element(
@ -188,7 +192,12 @@ impl MoveGrabState {
Key::Window(Usage::SnappingIndicator, self.window.key()),
overlay_geometry,
thickness,
theme.radius_s()[0] as u8, // TODO: Fix once shaders support 4 corner radii customization
[
theme.radius_s()[0] as u8,
theme.radius_s()[1] as u8,
theme.radius_s()[2] as u8,
theme.radius_s()[3] as u8,
],
1.0,
[
active_window_hint.red,

View file

@ -1615,10 +1615,15 @@ impl FloatingLayout {
let guard = corners.lock().unwrap();
// TODO support multiple radius values
Some(guard.top_left)
Some([
guard.top_right,
guard.bottom_right,
guard.top_left,
guard.bottom_left,
])
})
})
.unwrap_or(indicator_thickness);
.unwrap_or([indicator_thickness; 4]);
if indicator_thickness > 0 {
let element = IndicatorShader::focus_element(
renderer,

View file

@ -4483,7 +4483,7 @@ where
Key::Group(Arc::downgrade(alive)),
geo,
4,
if render_active_child { 16 } else { 8 },
[if render_active_child { 16 } else { 8 }; 4],
alpha * if render_potential_group { 0.40 } else { 1.0 },
group_color,
)
@ -4500,7 +4500,7 @@ where
Key::Group(Arc::downgrade(alive)),
geo,
4,
8,
[8; 4],
alpha * 0.40,
group_color,
)
@ -4563,7 +4563,7 @@ where
Key::Group(Arc::downgrade(alive)),
geo,
4,
8,
[8; 4],
alpha * 0.15,
group_color,
)
@ -4799,7 +4799,7 @@ where
Key::Window(Usage::PotentialGroupIndicator, mapped.key()),
geo,
4,
8,
[8; 4],
alpha * 0.40,
group_color,
)
@ -5035,10 +5035,15 @@ where
let guard = corners.lock().unwrap();
// TODO support multiple radius values
Some(guard.top_left)
Some([
guard.top_right,
guard.bottom_right,
guard.top_left,
guard.bottom_left,
])
})
})
.unwrap_or(indicator_thickness);
.unwrap_or([indicator_thickness; 4]);
if is_minimizing && indicator_thickness > 0 {
elements.push(CosmicMappedRenderElement::FocusIndicator(
IndicatorShader::focus_element(
@ -5323,11 +5328,15 @@ where
let guard = corners.lock().unwrap();
// TODO support multiple radius values
Some(guard.top_left)
Some([
guard.top_right,
guard.bottom_right,
guard.top_left,
guard.bottom_left,
])
})
})
.unwrap_or(indicator_thickness);
.unwrap_or([indicator_thickness; 4]);
swap_elements.push(CosmicMappedRenderElement::FocusIndicator(
IndicatorShader::focus_element(
renderer,
@ -5423,11 +5432,16 @@ where
let guard = corners.lock().unwrap();
// TODO support multiple radius values
Some(guard.top_left)
Some([
guard.top_right,
guard.bottom_right,
guard.top_left,
guard.bottom_left,
])
})
})
.unwrap_or(indicator_thickness),
_ => 1,
.unwrap_or([indicator_thickness; 4]),
_ => [1; 4],
};
if !swap_desc
.as_ref()