diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-10-14 18:08:44 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-10-14 18:08:44 +0300 |
| commit | be7fbd418fcee2d2ff9f80aa15f1eb8ff0d83afb (patch) | |
| tree | b6e81871277ffece2b29984e7f94bde67f66d684 /src/layout/monitor.rs | |
| parent | 06ec9eecdb6d41bc50258cc6b53bf2b4d8c82d56 (diff) | |
| download | niri-be7fbd418fcee2d2ff9f80aa15f1eb8ff0d83afb.tar.gz niri-be7fbd418fcee2d2ff9f80aa15f1eb8ff0d83afb.tar.bz2 niri-be7fbd418fcee2d2ff9f80aa15f1eb8ff0d83afb.zip | |
layout: Return Tile + info upon removal
Diffstat (limited to 'src/layout/monitor.rs')
| -rw-r--r-- | src/layout/monitor.rs | 62 |
1 files changed, 34 insertions, 28 deletions
diff --git a/src/layout/monitor.rs b/src/layout/monitor.rs index 71204ce7..9d665bee 100644 --- a/src/layout/monitor.rs +++ b/src/layout/monitor.rs @@ -458,18 +458,20 @@ impl<W: LayoutElement> Monitor<W> { } let column = &workspace.columns[workspace.active_column_idx]; - let width = column.width; - let is_full_width = column.is_full_width; - let window = workspace - .remove_tile_by_idx( - workspace.active_column_idx, - column.active_tile_idx, - Transaction::new(), - None, - ) - .into_window(); + let removed = workspace.remove_tile_by_idx( + workspace.active_column_idx, + column.active_tile_idx, + Transaction::new(), + None, + ); - self.add_window(new_idx, window, true, width, is_full_width); + self.add_window( + new_idx, + removed.tile.into_window(), + true, + removed.width, + removed.is_full_width, + ); } pub fn move_to_workspace_down(&mut self) { @@ -486,18 +488,20 @@ impl<W: LayoutElement> Monitor<W> { } let column = &workspace.columns[workspace.active_column_idx]; - let width = column.width; - let is_full_width = column.is_full_width; - let window = workspace - .remove_tile_by_idx( - workspace.active_column_idx, - column.active_tile_idx, - Transaction::new(), - None, - ) - .into_window(); + let removed = workspace.remove_tile_by_idx( + workspace.active_column_idx, + column.active_tile_idx, + Transaction::new(), + None, + ); - self.add_window(new_idx, window, true, width, is_full_width); + self.add_window( + new_idx, + removed.tile.into_window(), + true, + removed.width, + removed.is_full_width, + ); } pub fn move_to_workspace(&mut self, window: Option<&W::Id>, idx: usize) { @@ -534,17 +538,19 @@ impl<W: LayoutElement> Monitor<W> { let workspace = &mut self.workspaces[source_workspace_idx]; let column = &workspace.columns[col_idx]; - let width = column.width; - let is_full_width = column.is_full_width; let activate = source_workspace_idx == self.active_workspace_idx && col_idx == workspace.active_column_idx && tile_idx == column.active_tile_idx; - let window = workspace - .remove_tile_by_idx(col_idx, tile_idx, Transaction::new(), None) - .into_window(); + let removed = workspace.remove_tile_by_idx(col_idx, tile_idx, Transaction::new(), None); - self.add_window(new_idx, window, activate, width, is_full_width); + self.add_window( + new_idx, + removed.tile.into_window(), + activate, + removed.width, + removed.is_full_width, + ); if self.workspace_switch.is_none() { self.clean_up_workspaces(); |
