layout: Remove remove_active_tile()
Browse files at this commitdc97847d1380cae84f9872d7fced3443da82f38aParent: d6d80055 changed files +10 -48
- src/layout/floating.rs +0 -5
- src/layout/mod.rs +5 -6
- src/layout/monitor.rs +5 -6
- src/layout/scrolling.rs +0 -14
- src/layout/workspace.rs +0 -17
src/layout/floating.rsmodified+0 -5
| @@ -498,11 +498,6 @@ impl<W: LayoutElement> FloatingSpace<W> { | |||
| 498 | } | 498 | } |
| 499 | } | 499 | } |
| 500 | 500 | ||
| 501 | - pub fn remove_active_tile(&mut self) -> Option<RemovedTile<W>> { | ||
| 502 | - let id = self.active_window_id.clone()?; | ||
| 503 | - Some(self.remove_tile(&id)) | ||
| 504 | - } | ||
| 505 | - | ||
| 506 | pub fn remove_tile(&mut self, id: &W::Id) -> RemovedTile<W> { | 501 | pub fn remove_tile(&mut self, id: &W::Id) -> RemovedTile<W> { |
| 507 | let idx = self.idx_of(id).unwrap(); | 502 | let idx = self.idx_of(id).unwrap(); |
| 508 | self.remove_tile_by_idx(idx) | 503 | self.remove_tile_by_idx(idx) |
src/layout/mod.rsmodified+5 -6
| @@ -3357,14 +3357,13 @@ impl<W: LayoutElement> Layout<W> { | |||
| 3357 | }; | 3357 | }; |
| 3358 | 3358 | ||
| 3359 | let ws = &mut mon.workspaces[ws_idx]; | 3359 | let ws = &mut mon.workspaces[ws_idx]; |
| 3360 | - let transaction = Transaction::new(); | 3360 | + let Some(window) = window.or_else(|| ws.active_window().map(|win| win.id())) else { |
| 3361 | - let mut removed = if let Some(window) = window { | ||
| 3362 | - ws.remove_tile(window, transaction) | ||
| 3363 | - } else if let Some(removed) = ws.remove_active_tile(transaction) { | ||
| 3364 | - removed | ||
| 3365 | - } else { | ||
| 3366 | return; | 3361 | return; |
| 3367 | }; | 3362 | }; |
| 3363 | + let window = window.clone(); | ||
| 3364 | + | ||
| 3365 | + let transaction = Transaction::new(); | ||
| 3366 | + let mut removed = ws.remove_tile(&window, transaction); | ||
| 3368 | 3367 | ||
| 3369 | removed.tile.stop_move_animations(); | 3368 | removed.tile.stop_move_animations(); |
| 3370 | 3369 | ||
src/layout/monitor.rsmodified+5 -6
| @@ -818,14 +818,13 @@ impl<W: LayoutElement> Monitor<W> { | |||
| 818 | }); | 818 | }); |
| 819 | 819 | ||
| 820 | let workspace = &mut self.workspaces[source_workspace_idx]; | 820 | let workspace = &mut self.workspaces[source_workspace_idx]; |
| 821 | - let transaction = Transaction::new(); | 821 | + let Some(window) = window.or_else(|| workspace.active_window().map(|win| win.id())) else { |
| 822 | - let removed = if let Some(window) = window { | ||
| 823 | - workspace.remove_tile(window, transaction) | ||
| 824 | - } else if let Some(removed) = workspace.remove_active_tile(transaction) { | ||
| 825 | - removed | ||
| 826 | - } else { | ||
| 827 | return; | 822 | return; |
| 828 | }; | 823 | }; |
| 824 | + let window = window.clone(); | ||
| 825 | + | ||
| 826 | + let transaction = Transaction::new(); | ||
| 827 | + let removed = workspace.remove_tile(&window, transaction); | ||
| 829 | 828 | ||
| 830 | self.add_tile( | 829 | self.add_tile( |
| 831 | removed.tile, | 830 | removed.tile, |
src/layout/scrolling.rsmodified+0 -14
| @@ -1026,20 +1026,6 @@ impl<W: LayoutElement> ScrollingSpace<W> { | |||
| 1026 | } | 1026 | } |
| 1027 | } | 1027 | } |
| 1028 | 1028 | ||
| 1029 | - pub fn remove_active_tile(&mut self, transaction: Transaction) -> Option<RemovedTile<W>> { | ||
| 1030 | - if self.columns.is_empty() { | ||
| 1031 | - return None; | ||
| 1032 | - } | ||
| 1033 | - | ||
| 1034 | - let column = &self.columns[self.active_column_idx]; | ||
| 1035 | - Some(self.remove_tile_by_idx( | ||
| 1036 | - self.active_column_idx, | ||
| 1037 | - column.active_tile_idx, | ||
| 1038 | - transaction, | ||
| 1039 | - None, | ||
| 1040 | - )) | ||
| 1041 | - } | ||
| 1042 | - | ||
| 1043 | pub fn remove_tile(&mut self, window: &W::Id, transaction: Transaction) -> RemovedTile<W> { | 1029 | pub fn remove_tile(&mut self, window: &W::Id, transaction: Transaction) -> RemovedTile<W> { |
| 1044 | let column_idx = self | 1030 | let column_idx = self |
| 1045 | .columns | 1031 | .columns |
src/layout/workspace.rsmodified+0 -17
| @@ -751,23 +751,6 @@ impl<W: LayoutElement> Workspace<W> { | |||
| 751 | removed | 751 | removed |
| 752 | } | 752 | } |
| 753 | 753 | ||
| 754 | - pub fn remove_active_tile(&mut self, transaction: Transaction) -> Option<RemovedTile<W>> { | ||
| 755 | - let from_floating = self.floating_is_active.get(); | ||
| 756 | - let removed = if from_floating { | ||
| 757 | - self.floating.remove_active_tile()? | ||
| 758 | - } else { | ||
| 759 | - self.scrolling.remove_active_tile(transaction)? | ||
| 760 | - }; | ||
| 761 | - | ||
| 762 | - if let Some(output) = &self.output { | ||
| 763 | - removed.tile.window().output_leave(output); | ||
| 764 | - } | ||
| 765 | - | ||
| 766 | - self.update_focus_floating_tiling_after_removing(from_floating); | ||
| 767 | - | ||
| 768 | - Some(removed) | ||
| 769 | - } | ||
| 770 | - | ||
| 771 | pub fn remove_active_column(&mut self) -> Option<Column<W>> { | 754 | pub fn remove_active_column(&mut self) -> Option<Column<W>> { |
| 772 | let from_floating = self.floating_is_active.get(); | 755 | let from_floating = self.floating_is_active.get(); |
| 773 | if from_floating { | 756 | if from_floating { |