From 18f06a7acd79feb16dc667b68a1ffd0d59e234c8 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Mon, 12 Feb 2024 09:34:54 +0400 Subject: Fix border getting default values for focus ring --- src/layout/mod.rs | 19 ++++++++++++++++--- src/layout/tile.rs | 4 ++-- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'src/layout') diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 9443093f..dfc7ee0a 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -153,7 +153,7 @@ pub struct Options { /// Extra padding around the working area in logical pixels. pub struts: Struts, pub focus_ring: niri_config::FocusRing, - pub border: niri_config::FocusRing, + pub border: niri_config::Border, pub center_focused_column: CenterFocusedColumn, /// Column widths that `toggle_width()` switches between. pub preset_widths: Vec, @@ -168,7 +168,7 @@ impl Default for Options { gaps: 16, struts: Default::default(), focus_ring: Default::default(), - border: niri_config::FocusRing::default_border(), + border: Default::default(), center_focused_column: Default::default(), preset_widths: vec![ ColumnWidth::Proportion(1. / 3.), @@ -2818,12 +2818,25 @@ mod tests { } } + prop_compose! { + fn arbitrary_border()( + off in any::(), + width in arbitrary_spacing(), + ) -> niri_config::Border { + niri_config::Border { + off, + width, + ..Default::default() + } + } + } + prop_compose! { fn arbitrary_options()( gaps in arbitrary_spacing(), struts in arbitrary_struts(), focus_ring in arbitrary_focus_ring(), - border in arbitrary_focus_ring(), + border in arbitrary_border(), center_focused_column in arbitrary_center_focused_column(), ) -> Options { Options { diff --git a/src/layout/tile.rs b/src/layout/tile.rs index 62f79a77..54c38d15 100644 --- a/src/layout/tile.rs +++ b/src/layout/tile.rs @@ -62,7 +62,7 @@ impl Tile { pub fn new(window: W, options: Rc) -> Self { Self { window, - border: FocusRing::new(options.border), + border: FocusRing::new(options.border.into()), focus_ring: FocusRing::new(options.focus_ring), is_fullscreen: false, // FIXME: up-to-date fullscreen right away, but we need size. fullscreen_backdrop: SolidColorBuffer::new((0, 0), [0., 0., 0., 1.]), @@ -73,7 +73,7 @@ impl Tile { } pub fn update_config(&mut self, options: Rc) { - self.border.update_config(options.border); + self.border.update_config(options.border.into()); self.focus_ring.update_config(options.focus_ring); self.options = options; } -- cgit