diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2025-01-31 19:24:26 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-01-31 21:15:43 +0300 |
| commit | 88c6778771d8196621072b562466f6e8e68dbbc3 (patch) | |
| tree | 04e4268b1b602f96e2e12316f8dd25ed344202a2 /src | |
| parent | 73f6d3366ee801e27f7c50601117e5e747d88899 (diff) | |
| download | niri-88c6778771d8196621072b562466f6e8e68dbbc3.tar.gz niri-88c6778771d8196621072b562466f6e8e68dbbc3.tar.bz2 niri-88c6778771d8196621072b562466f6e8e68dbbc3.zip | |
Extract SizeChange::from(PresetSize)
Diffstat (limited to 'src')
| -rw-r--r-- | src/layout/floating.rs | 7 | ||||
| -rw-r--r-- | src/layout/mod.rs | 5 |
2 files changed, 2 insertions, 10 deletions
diff --git a/src/layout/floating.rs b/src/layout/floating.rs index c6a17e30..3ac995f0 100644 --- a/src/layout/floating.rs +++ b/src/layout/floating.rs @@ -677,12 +677,7 @@ impl<W: LayoutElement> FloatingSpace<W> { }; let preset = self.options.preset_window_heights[preset_idx]; - let change = match preset { - PresetSize::Proportion(prop) => SizeChange::SetProportion(prop * 100.), - PresetSize::Fixed(fixed) => SizeChange::SetFixed(fixed), - }; - - self.set_window_height(Some(&id), change, true); + self.set_window_height(Some(&id), SizeChange::from(preset), true); let tile = &mut self.tiles[idx]; tile.floating_preset_height_idx = Some(preset_idx); diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 2631dd72..ff355615 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -862,10 +862,7 @@ impl<W: LayoutElement> Layout<W> { activate: ActivateWindow, ) -> Option<&Output> { let resolved_width = self.resolve_default_width(&window, width, is_floating); - let resolved_height = height.map(|h| match h { - PresetSize::Proportion(prop) => SizeChange::SetProportion(prop * 100.), - PresetSize::Fixed(fixed) => SizeChange::SetFixed(fixed), - }); + let resolved_height = height.map(SizeChange::from); let id = window.id().clone(); match &mut self.monitor_set { |
