diff options
| author | LunarEclipse <luna@lunareclipse.zone> | 2025-03-09 18:55:17 +0100 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-03-31 14:13:20 +0300 |
| commit | 3b1bf34e21652b2ba6ce621226c05f74dccbefbb (patch) | |
| tree | e791a057c01fbfd76cfb1a8cea9b638e27263b1d /niri-config/src | |
| parent | bd927b54e09d9f37356874d12b9e57dd28d2d837 (diff) | |
| download | niri-3b1bf34e21652b2ba6ce621226c05f74dccbefbb.tar.gz niri-3b1bf34e21652b2ba6ce621226c05f74dccbefbb.tar.bz2 niri-3b1bf34e21652b2ba6ce621226c05f74dccbefbb.zip | |
Allow negative shadow spread
Diffstat (limited to 'niri-config/src')
| -rw-r--r-- | niri-config/src/lib.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs index 56bff592..d622bfcd 100644 --- a/niri-config/src/lib.rs +++ b/niri-config/src/lib.rs @@ -711,7 +711,7 @@ pub struct Shadow { #[knuffel(child, unwrap(argument), default = Self::default().softness)] pub softness: FloatOrInt<0, 1024>, #[knuffel(child, unwrap(argument), default = Self::default().spread)] - pub spread: FloatOrInt<0, 1024>, + pub spread: FloatOrInt<-1024, 1024>, #[knuffel(child, unwrap(argument), default = Self::default().draw_behind_window)] pub draw_behind_window: bool, #[knuffel(child, default = Self::default().color)] @@ -1379,7 +1379,7 @@ pub struct ShadowRule { #[knuffel(child, unwrap(argument))] pub softness: Option<FloatOrInt<0, 1024>>, #[knuffel(child, unwrap(argument))] - pub spread: Option<FloatOrInt<0, 1024>>, + pub spread: Option<FloatOrInt<-1024, 1024>>, #[knuffel(child, unwrap(argument))] pub draw_behind_window: Option<bool>, #[knuffel(child)] @@ -2346,6 +2346,7 @@ impl CornerRadius { } pub fn expanded_by(mut self, width: f32) -> Self { + // Radius = 0 is preserved, so that square corners remain square. if self.top_left > 0. { self.top_left += width; } @@ -2359,6 +2360,13 @@ impl CornerRadius { self.bottom_left += width; } + if width < 0. { + self.top_left = self.top_left.max(0.); + self.top_right = self.top_right.max(0.); + self.bottom_left = self.bottom_left.max(0.); + self.bottom_right = self.bottom_right.max(0.); + } + self } |
