diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-12-22 09:28:57 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-12-30 20:12:37 +0300 |
| commit | f4f2a1f6deeffa5c13d871c534ac99ea398e9175 (patch) | |
| tree | 52c1797d384c7cfc8b5950be5b6b406434dba1fd /src/layout/tile.rs | |
| parent | a440805ea1136f6e0cb852ff71b89b12dd426a7d (diff) | |
| download | niri-f4f2a1f6deeffa5c13d871c534ac99ea398e9175.tar.gz niri-f4f2a1f6deeffa5c13d871c534ac99ea398e9175.tar.bz2 niri-f4f2a1f6deeffa5c13d871c534ac99ea398e9175.zip | |
floating: Remember and restore window size
Diffstat (limited to 'src/layout/tile.rs')
| -rw-r--r-- | src/layout/tile.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/layout/tile.rs b/src/layout/tile.rs index 1b9aac2d..13adbd50 100644 --- a/src/layout/tile.rs +++ b/src/layout/tile.rs @@ -54,6 +54,12 @@ pub struct Tile<W: LayoutElement> { /// Whether the tile should float upon unfullscreening. unfullscreen_to_floating: bool, + /// The size that the window should assume when going floating. + /// + /// This is generally the last size the window had when it was floating. It can be unknown if + /// the window starts out in the tiling layout or fullscreen. + floating_window_size: Option<Size<i32, Logical>>, + /// The animation upon opening a window. open_animation: Option<OpenAnimation>, @@ -128,6 +134,7 @@ impl<W: LayoutElement> Tile<W> { fullscreen_backdrop: SolidColorBuffer::new((0., 0.), [0., 0., 0., 1.]), fullscreen_size: Default::default(), unfullscreen_to_floating: false, + floating_window_size: None, open_animation: None, resize_animation: None, move_x_animation: None, @@ -935,6 +942,14 @@ impl<W: LayoutElement> Tile<W> { self.unfullscreen_to_floating = value; } + pub fn floating_window_size(&self) -> Option<Size<i32, Logical>> { + self.floating_window_size + } + + pub fn set_floating_window_size(&mut self, floating_window_size: Size<i32, Logical>) { + self.floating_window_size = Some(floating_window_size); + } + #[cfg(test)] pub fn verify_invariants(&self) { use approx::assert_abs_diff_eq; |
