mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-23 02:05:33 +07:00
overview: Activate window upon dropping from interactive move
This commit is contained in:
+9
-9
@@ -3543,6 +3543,7 @@ impl<W: LayoutElement> Layout<W> {
|
|||||||
column_idx: None,
|
column_idx: None,
|
||||||
},
|
},
|
||||||
activate,
|
activate,
|
||||||
|
true,
|
||||||
removed.width,
|
removed.width,
|
||||||
removed.is_full_width,
|
removed.is_full_width,
|
||||||
removed.is_floating,
|
removed.is_floating,
|
||||||
@@ -4392,11 +4393,7 @@ impl<W: LayoutElement> Layout<W> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Dragging in the overview shouldn't switch the workspace and so on.
|
// Dragging in the overview shouldn't switch the workspace and so on.
|
||||||
let activate = if self.overview_open {
|
let allow_to_activate_workspace = !self.overview_open;
|
||||||
ActivateWindow::No
|
|
||||||
} else {
|
|
||||||
ActivateWindow::Yes
|
|
||||||
};
|
|
||||||
|
|
||||||
match &mut self.monitor_set {
|
match &mut self.monitor_set {
|
||||||
MonitorSet::Normal {
|
MonitorSet::Normal {
|
||||||
@@ -4489,7 +4486,8 @@ impl<W: LayoutElement> Layout<W> {
|
|||||||
id: ws_id,
|
id: ws_id,
|
||||||
column_idx: Some(column_idx),
|
column_idx: Some(column_idx),
|
||||||
},
|
},
|
||||||
activate,
|
ActivateWindow::Yes,
|
||||||
|
allow_to_activate_workspace,
|
||||||
move_.width,
|
move_.width,
|
||||||
move_.is_full_width,
|
move_.is_full_width,
|
||||||
false,
|
false,
|
||||||
@@ -4501,7 +4499,8 @@ impl<W: LayoutElement> Layout<W> {
|
|||||||
column_idx,
|
column_idx,
|
||||||
Some(tile_idx),
|
Some(tile_idx),
|
||||||
move_.tile,
|
move_.tile,
|
||||||
activate == ActivateWindow::Yes,
|
true,
|
||||||
|
allow_to_activate_workspace,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
InsertPosition::Floating => {
|
InsertPosition::Floating => {
|
||||||
@@ -4543,7 +4542,8 @@ impl<W: LayoutElement> Layout<W> {
|
|||||||
id: ws_id,
|
id: ws_id,
|
||||||
column_idx: None,
|
column_idx: None,
|
||||||
},
|
},
|
||||||
activate,
|
ActivateWindow::Yes,
|
||||||
|
allow_to_activate_workspace,
|
||||||
move_.width,
|
move_.width,
|
||||||
move_.is_full_width,
|
move_.is_full_width,
|
||||||
true,
|
true,
|
||||||
@@ -4578,7 +4578,7 @@ impl<W: LayoutElement> Layout<W> {
|
|||||||
ws.add_tile(
|
ws.add_tile(
|
||||||
move_.tile,
|
move_.tile,
|
||||||
WorkspaceAddWindowTarget::Auto,
|
WorkspaceAddWindowTarget::Auto,
|
||||||
activate,
|
ActivateWindow::Yes,
|
||||||
move_.width,
|
move_.width,
|
||||||
move_.is_full_width,
|
move_.is_full_width,
|
||||||
move_.is_floating,
|
move_.is_floating,
|
||||||
|
|||||||
+19
-3
@@ -439,7 +439,15 @@ impl<W: LayoutElement> Monitor<W> {
|
|||||||
// monitor. So we can use any workspace, not necessarily the exact target workspace.
|
// monitor. So we can use any workspace, not necessarily the exact target workspace.
|
||||||
let tile = self.workspaces[0].make_tile(window);
|
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) {
|
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(
|
pub fn add_tile(
|
||||||
&mut self,
|
&mut self,
|
||||||
tile: Tile<W>,
|
tile: Tile<W>,
|
||||||
target: MonitorAddWindowTarget<W>,
|
target: MonitorAddWindowTarget<W>,
|
||||||
activate: ActivateWindow,
|
activate: ActivateWindow,
|
||||||
|
// FIXME: Refactor ActivateWindow enum to make this better.
|
||||||
|
allow_to_activate_workspace: bool,
|
||||||
width: ColumnWidth,
|
width: ColumnWidth,
|
||||||
is_full_width: bool,
|
is_full_width: bool,
|
||||||
is_floating: bool,
|
is_floating: bool,
|
||||||
@@ -516,7 +527,7 @@ impl<W: LayoutElement> Monitor<W> {
|
|||||||
workspace_idx += 1;
|
workspace_idx += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if activate.map_smart(|| false) {
|
if allow_to_activate_workspace && activate.map_smart(|| false) {
|
||||||
self.activate_workspace(workspace_idx);
|
self.activate_workspace(workspace_idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -528,6 +539,8 @@ impl<W: LayoutElement> Monitor<W> {
|
|||||||
tile_idx: Option<usize>,
|
tile_idx: Option<usize>,
|
||||||
tile: Tile<W>,
|
tile: Tile<W>,
|
||||||
activate: bool,
|
activate: bool,
|
||||||
|
// FIXME: Refactor ActivateWindow enum to make this better.
|
||||||
|
allow_to_activate_workspace: bool,
|
||||||
) {
|
) {
|
||||||
let workspace = &mut self.workspaces[workspace_idx];
|
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
|
// 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.
|
// 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);
|
self.activate_workspace(workspace_idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -631,6 +644,7 @@ impl<W: LayoutElement> Monitor<W> {
|
|||||||
column_idx: None,
|
column_idx: None,
|
||||||
},
|
},
|
||||||
ActivateWindow::Yes,
|
ActivateWindow::Yes,
|
||||||
|
true,
|
||||||
removed.width,
|
removed.width,
|
||||||
removed.is_full_width,
|
removed.is_full_width,
|
||||||
removed.is_floating,
|
removed.is_floating,
|
||||||
@@ -658,6 +672,7 @@ impl<W: LayoutElement> Monitor<W> {
|
|||||||
column_idx: None,
|
column_idx: None,
|
||||||
},
|
},
|
||||||
ActivateWindow::Yes,
|
ActivateWindow::Yes,
|
||||||
|
true,
|
||||||
removed.width,
|
removed.width,
|
||||||
removed.is_full_width,
|
removed.is_full_width,
|
||||||
removed.is_floating,
|
removed.is_floating,
|
||||||
@@ -712,6 +727,7 @@ impl<W: LayoutElement> Monitor<W> {
|
|||||||
} else {
|
} else {
|
||||||
ActivateWindow::No
|
ActivateWindow::No
|
||||||
},
|
},
|
||||||
|
true,
|
||||||
removed.width,
|
removed.width,
|
||||||
removed.is_full_width,
|
removed.is_full_width,
|
||||||
removed.is_floating,
|
removed.is_floating,
|
||||||
|
|||||||
Reference in New Issue
Block a user