aboutsummaryrefslogtreecommitdiff
path: root/src/layout/tile.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-12-24 10:51:00 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2024-12-30 20:12:37 +0300
commit53e1c58cc53c3868c236cc8877816ed4aab5b7b0 (patch)
tree58135cd15e08fe8e7c89912da00fa89de4afcb22 /src/layout/tile.rs
parent4b9ecdd11d146df44320eba12bead3e9677a2060 (diff)
downloadniri-53e1c58cc53c3868c236cc8877816ed4aab5b7b0.tar.gz
niri-53e1c58cc53c3868c236cc8877816ed4aab5b7b0.tar.bz2
niri-53e1c58cc53c3868c236cc8877816ed4aab5b7b0.zip
Remember floating window position
Diffstat (limited to 'src/layout/tile.rs')
-rw-r--r--src/layout/tile.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/layout/tile.rs b/src/layout/tile.rs
index 13adbd50..586b950a 100644
--- a/src/layout/tile.rs
+++ b/src/layout/tile.rs
@@ -9,7 +9,7 @@ use smithay::utils::{Logical, Point, Rectangle, Scale, Size, Transform};
use super::focus_ring::{FocusRing, FocusRingRenderElement};
use super::opening_window::{OpenAnimation, OpeningWindowRenderElement};
use super::{
- LayoutElement, LayoutElementRenderElement, LayoutElementRenderSnapshot, Options,
+ LayoutElement, LayoutElementRenderElement, LayoutElementRenderSnapshot, Options, SizeFrac,
RESIZE_ANIMATION_THRESHOLD,
};
use crate::animation::{Animation, Clock};
@@ -60,6 +60,13 @@ pub struct Tile<W: LayoutElement> {
/// the window starts out in the tiling layout or fullscreen.
floating_window_size: Option<Size<i32, Logical>>,
+ /// The position that the tile should assume when going floating, relative to the floating
+ /// space working area.
+ ///
+ /// This is generally the last position the tile had when it was floating. It can be unknown if
+ /// the window starts out in the tiling layout.
+ floating_pos: Option<Point<f64, SizeFrac>>,
+
/// The animation upon opening a window.
open_animation: Option<OpenAnimation>,
@@ -135,6 +142,7 @@ impl<W: LayoutElement> Tile<W> {
fullscreen_size: Default::default(),
unfullscreen_to_floating: false,
floating_window_size: None,
+ floating_pos: None,
open_animation: None,
resize_animation: None,
move_x_animation: None,
@@ -950,6 +958,14 @@ impl<W: LayoutElement> Tile<W> {
self.floating_window_size = Some(floating_window_size);
}
+ pub fn floating_pos(&self) -> Option<Point<f64, SizeFrac>> {
+ self.floating_pos
+ }
+
+ pub fn set_floating_pos(&mut self, floating_pos: Point<f64, SizeFrac>) {
+ self.floating_pos = Some(floating_pos);
+ }
+
#[cfg(test)]
pub fn verify_invariants(&self) {
use approx::assert_abs_diff_eq;