From 322b5cbac74513e6f34c9519c1591aa37f83688a Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Tue, 6 Feb 2024 19:09:15 +0400 Subject: Add Layout::with_options() --- src/layout/mod.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/layout') diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 6121a1f2..99916d26 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -307,9 +307,13 @@ impl LayoutElement for Window { impl Layout { pub fn new(config: &Config) -> Self { + Self::with_options(Options::from_config(config)) + } + + pub fn with_options(options: Options) -> Self { Self { monitor_set: MonitorSet::NoOutputs { workspaces: vec![] }, - options: Rc::new(Options::from_config(config)), + options: Rc::new(options), } } @@ -1598,10 +1602,7 @@ mod tests { impl Default for Layout { fn default() -> Self { - Self { - monitor_set: MonitorSet::NoOutputs { workspaces: vec![] }, - options: Rc::new(Options::default()), - } + Self::with_options(Default::default()) } } @@ -2016,10 +2017,7 @@ mod tests { #[track_caller] fn check_ops_with_options(options: Options, ops: &[Op]) { - let mut layout = Layout { - options: Rc::new(options), - ..Default::default() - }; + let mut layout = Layout::with_options(options); for op in ops { op.apply(&mut layout); -- cgit