From d5592743cb04cef3fe50c987b7ba9349c5090dbd Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sun, 2 Feb 2025 08:41:42 +0300 Subject: Add impl From for Gradient --- src/layout/focus_ring.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/layout') diff --git a/src/layout/focus_ring.rs b/src/layout/focus_ring.rs index b6c65b3f..3d97cb02 100644 --- a/src/layout/focus_ring.rs +++ b/src/layout/focus_ring.rs @@ -1,7 +1,7 @@ use std::iter::zip; use arrayvec::ArrayVec; -use niri_config::{CornerRadius, Gradient, GradientInterpolation, GradientRelativeTo}; +use niri_config::{CornerRadius, Gradient, GradientRelativeTo}; use smithay::backend::renderer::element::Kind; use smithay::utils::{Logical, Point, Rectangle, Size}; @@ -86,13 +86,7 @@ impl FocusRing { self.use_border_shader = radius != CornerRadius::default() || gradient.is_some(); // Set the defaults for solid color + rounded corners. - let gradient = gradient.unwrap_or(Gradient { - from: color, - to: color, - angle: 0, - relative_to: GradientRelativeTo::Window, - in_: GradientInterpolation::default(), - }); + let gradient = gradient.unwrap_or_else(|| Gradient::from(color)); let full_rect = Rectangle::new(Point::from((-width, -width)), self.full_size); let gradient_area = match gradient.relative_to { -- cgit