diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2025-04-26 13:23:57 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-04-26 13:29:36 +0300 |
| commit | 78e3daf5f82b5870e998faf0e1efeaa048730976 (patch) | |
| tree | 1f723d76dfc83c6a827984cd4cd466408154d589 /src | |
| parent | a99a0b2492722d2c254b7bdf172d388123de8996 (diff) | |
| download | niri-78e3daf5f82b5870e998faf0e1efeaa048730976.tar.gz niri-78e3daf5f82b5870e998faf0e1efeaa048730976.tar.bz2 niri-78e3daf5f82b5870e998faf0e1efeaa048730976.zip | |
overview: Activate window upon dropping from interactive move
Diffstat (limited to 'src')
| -rw-r--r-- | src/layout/mod.rs | 18 | ||||
| -rw-r--r-- | src/layout/monitor.rs | 22 |
2 files changed, 28 insertions, 12 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs index c9ddfbaa..e62380b2 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -3543,6 +3543,7 @@ impl<W: LayoutElement> Layout<W> { column_idx: None, }, activate, + true, removed.width, removed.is_full_width, removed.is_floating, @@ -4392,11 +4393,7 @@ impl<W: LayoutElement> Layout<W> { } // Dragging in the overview shouldn't switch the workspace and so on. - let activate = if self.overview_open { - ActivateWindow::No - } else { - ActivateWindow::Yes - }; + let allow_to_activate_workspace = !self.overview_open; match &mut self.monitor_set { MonitorSet::Normal { @@ -4489,7 +4486,8 @@ impl<W: LayoutElement> Layout<W> { id: ws_id, column_idx: Some(column_idx), }, - activate, + ActivateWindow::Yes, + allow_to_activate_workspace, move_.width, move_.is_full_width, false, @@ -4501,7 +4499,8 @@ impl<W: LayoutElement> Layout<W> { column_idx, Some(tile_idx), move_.tile, - activate == ActivateWindow::Yes, + true, + allow_to_activate_workspace, ); } InsertPosition::Floating => { @@ -4543,7 +4542,8 @@ impl<W: LayoutElement> Layout<W> { id: ws_id, column_idx: None, }, - activate, + ActivateWindow::Yes, + allow_to_activate_workspace, move_.width, move_.is_full_width, true, @@ -4578,7 +4578,7 @@ impl<W: LayoutElement> Layout<W> { ws.add_tile( move_.tile, WorkspaceAddWindowTarget::Auto, - activate, + ActivateWindow::Yes, move_.width, move_.is_full_width, move_.is_floating, 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<W: LayoutElement> Monitor<W> { // 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<W>, activate: bool) { @@ -465,11 +473,14 @@ impl<W: LayoutElement> Monitor<W> { } } + #[allow(clippy::too_many_arguments)] pub fn add_tile( &mut self, tile: Tile<W>, target: MonitorAddWindowTarget<W>, 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<W: LayoutElement> Monitor<W> { 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<W: LayoutElement> Monitor<W> { tile_idx: Option<usize>, tile: Tile<W>, 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<W: LayoutElement> Monitor<W> { // 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<W: LayoutElement> Monitor<W> { column_idx: None, }, ActivateWindow::Yes, + true, removed.width, removed.is_full_width, removed.is_floating, @@ -658,6 +672,7 @@ impl<W: LayoutElement> Monitor<W> { column_idx: None, }, ActivateWindow::Yes, + true, removed.width, removed.is_full_width, removed.is_floating, @@ -712,6 +727,7 @@ impl<W: LayoutElement> Monitor<W> { } else { ActivateWindow::No }, + true, removed.width, removed.is_full_width, removed.is_floating, |
