aboutsummaryrefslogtreecommitdiff
path: root/src/layout/mod.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/mod.rs
parent4b9ecdd11d146df44320eba12bead3e9677a2060 (diff)
downloadniri-53e1c58cc53c3868c236cc8877816ed4aab5b7b0.tar.gz
niri-53e1c58cc53c3868c236cc8877816ed4aab5b7b0.tar.bz2
niri-53e1c58cc53c3868c236cc8877816ed4aab5b7b0.zip
Remember floating window position
Diffstat (limited to 'src/layout/mod.rs')
-rw-r--r--src/layout/mod.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index 26521f3e..2ed08ba8 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -81,6 +81,9 @@ pub const RESIZE_ANIMATION_THRESHOLD: f64 = 10.;
/// Pointer needs to move this far to pull a window from the layout.
const INTERACTIVE_MOVE_START_THRESHOLD: f64 = 256. * 256.;
+/// Size-relative units.
+pub struct SizeFrac;
+
niri_render_elements! {
LayoutElementRenderElement<R> => {
Wayland = WaylandSurfaceRenderElement<R>,
@@ -3482,14 +3485,17 @@ impl<W: LayoutElement> Layout<W> {
InsertPosition::Floating => {
let pos = move_.tile_render_location() - offset;
+ let mut tile = move_.tile;
+ let pos = mon.workspaces[ws_idx].floating_logical_to_size_frac(pos);
+ tile.set_floating_pos(pos);
+
// Set the floating size so it takes into account any window resizing that
// took place during the move.
- let mut tile = move_.tile;
if let Some(size) = tile.window().expected_size() {
tile.set_floating_window_size(size);
}
- mon.add_floating_tile(ws_idx, tile, Some(pos), true);
+ mon.add_floating_tile(ws_idx, tile, true);
}
}