From 2d9d83d3bdf947f3b6e6bb5a676de700ccf9179f Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Thu, 25 Sep 2025 11:24:57 -0400 Subject: [PATCH] fix(corner-radius): guard against corner radius being too large --- src/shell/element/surface.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/shell/element/surface.rs b/src/shell/element/surface.rs index 204dc4e9..381c4d99 100644 --- a/src/shell/element/surface.rs +++ b/src/shell/element/surface.rs @@ -141,11 +141,15 @@ impl CosmicSurface { let guard = corners.lock().unwrap(); + let size = ::geometry(self).size; + // guard against corner radius being too large, potentially disconnecting the outline + let half_min_dim = u8::try_from(size.w.min(size.h) / 2).unwrap_or(u8::MAX); + Some([ - guard.top_right, - guard.bottom_right, - guard.top_left, - guard.bottom_left, + guard.top_right.min(half_min_dim), + guard.bottom_right.min(half_min_dim), + guard.top_left.min(half_min_dim), + guard.bottom_left.min(half_min_dim), ]) }) })