shell/window: Respect sharp corners when tiled

This commit is contained in:
Victoria Brekenfeld 2025-12-15 18:57:16 +01:00 committed by Victoria Brekenfeld
parent fdf865b154
commit 5c656de9d4

View file

@ -614,19 +614,24 @@ impl CosmicWindow {
let is_tiled = p.is_tiled(); let is_tiled = p.is_tiled();
let appearance = p.appearance_conf.lock().unwrap(); let appearance = p.appearance_conf.lock().unwrap();
let round = ((!is_tiled && appearance.clip_floating_windows) let clip = ((!is_tiled && appearance.clip_floating_windows)
|| (is_tiled && appearance.clip_tiled_windows)) || (is_tiled && appearance.clip_tiled_windows))
&& !p.window.is_maximized(false); && !p.window.is_maximized(false);
let radii = p let round =
.theme (!is_tiled || appearance.clip_tiled_windows) && !p.window.is_maximized(false);
.lock() let radii = round
.unwrap() .then(|| {
.cosmic() p.theme
.radius_s() .lock()
.map(|x| if x < 4.0 { x } else { x + 4.0 }) .unwrap()
.map(|x| x.round() as u8); .cosmic()
.radius_s()
.map(|x| if x < 4.0 { x } else { x + 4.0 })
.map(|x| x.round() as u8)
})
.unwrap_or([0; 4]);
match (has_ssd, round) { match (has_ssd, clip) {
(has_ssd, true) => { (has_ssd, true) => {
let mut corners = p.window.corner_radius(geometry_size).unwrap_or(radii); let mut corners = p.window.corner_radius(geometry_size).unwrap_or(radii);
@ -794,6 +799,9 @@ pub struct DefaultDecorations;
impl Decorations<CosmicWindowInternal, Message> for DefaultDecorations { impl Decorations<CosmicWindowInternal, Message> for DefaultDecorations {
fn view(&self, win: &CosmicWindowInternal) -> cosmic::Element<'_, Message> { fn view(&self, win: &CosmicWindowInternal) -> cosmic::Element<'_, Message> {
let sharp_corners = win.window.is_maximized(false)
|| (win.is_tiled() && !win.appearance_conf.lock().unwrap().clip_tiled_windows);
let mut header = cosmic::widget::header_bar() let mut header = cosmic::widget::header_bar()
.title(win.last_title.lock().unwrap().clone()) .title(win.last_title.lock().unwrap().clone())
.on_drag(Message::DragStart) .on_drag(Message::DragStart)
@ -801,7 +809,8 @@ impl Decorations<CosmicWindowInternal, Message> for DefaultDecorations {
.focused(win.window.is_activated(false)) .focused(win.window.is_activated(false))
.on_double_click(Message::Maximize) .on_double_click(Message::Maximize)
.on_right_click(Message::Menu) .on_right_click(Message::Menu)
.is_ssd(true); .is_ssd(true)
.sharp_corners(sharp_corners);
if cosmic::config::show_minimize() { if cosmic::config::show_minimize() {
header = header.on_minimize(Message::Minimize) header = header.on_minimize(Message::Minimize)