aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-12-22 10:40:26 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2024-12-30 20:12:37 +0300
commit76a56352980fc9a646034c45e6f02093cc72fdb6 (patch)
tree36318d5a487c073d2bfa80674166bf139d85da51 /src
parentf4f2a1f6deeffa5c13d871c534ac99ea398e9175 (diff)
downloadniri-76a56352980fc9a646034c45e6f02093cc72fdb6.tar.gz
niri-76a56352980fc9a646034c45e6f02093cc72fdb6.tar.bz2
niri-76a56352980fc9a646034c45e6f02093cc72fdb6.zip
layout: Preserve the Tile when moving across workspaces
Diffstat (limited to 'src')
-rw-r--r--src/layout/floating.rs6
-rw-r--r--src/layout/monitor.rs60
2 files changed, 42 insertions, 24 deletions
diff --git a/src/layout/floating.rs b/src/layout/floating.rs
index f870b2f2..5c0eb121 100644
--- a/src/layout/floating.rs
+++ b/src/layout/floating.rs
@@ -606,6 +606,9 @@ impl<W: LayoutElement> FloatingSpace<W> {
let win_size = Size::from((win_width, win_height));
win.request_size_once(win_size, animate);
+
+ // Store it right away so pending resizes are not lost when moving across floating spaces.
+ tile.set_floating_window_size(win_size);
}
pub fn set_window_height(&mut self, id: Option<&W::Id>, change: SizeChange, animate: bool) {
@@ -636,6 +639,9 @@ impl<W: LayoutElement> FloatingSpace<W> {
let win_size = Size::from((win_width, win_height));
win.request_size_once(win_size, animate);
+
+ // Store it right away so pending resizes are not lost when moving across floating spaces.
+ tile.set_floating_window_size(win_size);
}
fn focus_directional(
diff --git a/src/layout/monitor.rs b/src/layout/monitor.rs
index 7bfc1084..844e932d 100644
--- a/src/layout/monitor.rs
+++ b/src/layout/monitor.rs
@@ -530,14 +530,18 @@ impl<W: LayoutElement> Monitor<W> {
return;
};
- self.add_window(
- new_idx,
- removed.tile.into_window(),
- true,
- removed.width,
- removed.is_full_width,
- removed.is_floating,
- );
+ if removed.is_floating {
+ self.add_floating_tile(new_idx, removed.tile, None, true);
+ } else {
+ self.add_tile(
+ new_idx,
+ None,
+ removed.tile,
+ true,
+ removed.width,
+ removed.is_full_width,
+ );
+ }
}
pub fn move_to_workspace_down(&mut self) {
@@ -553,14 +557,18 @@ impl<W: LayoutElement> Monitor<W> {
return;
};
- self.add_window(
- new_idx,
- removed.tile.into_window(),
- true,
- removed.width,
- removed.is_full_width,
- removed.is_floating,
- );
+ if removed.is_floating {
+ self.add_floating_tile(new_idx, removed.tile, None, true);
+ } else {
+ self.add_tile(
+ new_idx,
+ None,
+ removed.tile,
+ true,
+ removed.width,
+ removed.is_full_width,
+ );
+ }
}
pub fn move_to_workspace(&mut self, window: Option<&W::Id>, idx: usize) {
@@ -592,14 +600,18 @@ impl<W: LayoutElement> Monitor<W> {
return;
};
- self.add_window(
- new_idx,
- removed.tile.into_window(),
- activate,
- removed.width,
- removed.is_full_width,
- removed.is_floating,
- );
+ if removed.is_floating {
+ self.add_floating_tile(new_idx, removed.tile, None, activate);
+ } else {
+ self.add_tile(
+ new_idx,
+ None,
+ removed.tile,
+ activate,
+ removed.width,
+ removed.is_full_width,
+ );
+ }
if self.workspace_switch.is_none() {
self.clean_up_workspaces();