From 78e3daf5f82b5870e998faf0e1efeaa048730976 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sat, 26 Apr 2025 13:23:57 +0300 Subject: overview: Activate window upon dropping from interactive move --- src/layout/monitor.rs | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/layout/monitor.rs') diff --git a/src/layout/monitor.rs b/src/layout/monitor.rs index 67f3dc77..fc7b53a5 100644 --- a/src/layout/monitor.rs +++ b/src/layout/monitor.rs @@ -439,7 +439,15 @@ impl Monitor { // monitor. So we can use any workspace, not necessarily the exact target workspace. let tile = self.workspaces[0].make_tile(window); - self.add_tile(tile, target, activate, width, is_full_width, is_floating); + self.add_tile( + tile, + target, + activate, + true, + width, + is_full_width, + is_floating, + ); } pub fn add_column(&mut self, mut workspace_idx: usize, column: Column, activate: bool) { @@ -465,11 +473,14 @@ impl Monitor { } } + #[allow(clippy::too_many_arguments)] pub fn add_tile( &mut self, tile: Tile, target: MonitorAddWindowTarget, activate: ActivateWindow, + // FIXME: Refactor ActivateWindow enum to make this better. + allow_to_activate_workspace: bool, width: ColumnWidth, is_full_width: bool, is_floating: bool, @@ -516,7 +527,7 @@ impl Monitor { workspace_idx += 1; } - if activate.map_smart(|| false) { + if allow_to_activate_workspace && activate.map_smart(|| false) { self.activate_workspace(workspace_idx); } } @@ -528,6 +539,8 @@ impl Monitor { tile_idx: Option, tile: Tile, activate: bool, + // FIXME: Refactor ActivateWindow enum to make this better. + allow_to_activate_workspace: bool, ) { let workspace = &mut self.workspaces[workspace_idx]; @@ -541,7 +554,7 @@ impl Monitor { // Since we're adding window to an existing column, the workspace isn't empty, and // therefore cannot be the last one, so we never need to insert a new empty workspace. - if activate { + if allow_to_activate_workspace && activate { self.activate_workspace(workspace_idx); } } @@ -631,6 +644,7 @@ impl Monitor { column_idx: None, }, ActivateWindow::Yes, + true, removed.width, removed.is_full_width, removed.is_floating, @@ -658,6 +672,7 @@ impl Monitor { column_idx: None, }, ActivateWindow::Yes, + true, removed.width, removed.is_full_width, removed.is_floating, @@ -712,6 +727,7 @@ impl Monitor { } else { ActivateWindow::No }, + true, removed.width, removed.is_full_width, removed.is_floating, -- cgit