diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-02-06 19:09:15 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-02-06 19:09:15 +0400 |
| commit | 322b5cbac74513e6f34c9519c1591aa37f83688a (patch) | |
| tree | f9b98aa0291721efbeb7da7c6b5a2589ea51aa7d | |
| parent | 592791611a733ab9d6e64f453ad2bb5b438c0eda (diff) | |
| download | niri-322b5cbac74513e6f34c9519c1591aa37f83688a.tar.gz niri-322b5cbac74513e6f34c9519c1591aa37f83688a.tar.bz2 niri-322b5cbac74513e6f34c9519c1591aa37f83688a.zip | |
Add Layout::with_options()
| -rw-r--r-- | src/layout/mod.rs | 16 |
1 files changed, 7 insertions, 9 deletions
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<W: LayoutElement> Layout<W> { 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<W: LayoutElement> Default for Layout<W> { 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); |
