aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/layout/mod.rs10
-rw-r--r--src/layout/tests.rs33
2 files changed, 42 insertions, 1 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index 243730be..38af83d3 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -1142,7 +1142,15 @@ impl<W: LayoutElement> Layout<W> {
.filter(|move_| next_to == move_.tile.window().id())
.is_some()
{
- // The next_to window is being interactively moved.
+ // The next_to window is being interactively moved. If there are no
+ // other windows, we may have no workspaces at all.
+ if workspaces.is_empty() {
+ workspaces.push(Workspace::new_no_outputs(
+ self.clock.clone(),
+ self.options.clone(),
+ ));
+ }
+
(0, WorkspaceAddWindowTarget::Auto)
} else {
let ws_idx = workspaces
diff --git a/src/layout/tests.rs b/src/layout/tests.rs
index 6c20acc4..beb4b6ee 100644
--- a/src/layout/tests.rs
+++ b/src/layout/tests.rs
@@ -2938,6 +2938,39 @@ fn interactive_move_drop_on_other_output_during_animation() {
}
#[test]
+fn add_window_next_to_only_interactively_moved_without_outputs() {
+ let ops = [
+ Op::AddWindow {
+ params: TestWindowParams::new(2),
+ },
+ Op::AddOutput(1),
+ Op::InteractiveMoveBegin {
+ window: 2,
+ output_idx: 1,
+ px: 0.0,
+ py: 0.0,
+ },
+ Op::InteractiveMoveUpdate {
+ window: 2,
+ dx: 0.0,
+ dy: 3586.692842955048,
+ output_idx: 1,
+ px: 0.0,
+ py: 0.0,
+ },
+ Op::RemoveOutput(1),
+ // We have no outputs, and the only existing window is interactively moved, meaning there
+ // are no workspaces either.
+ Op::AddWindowNextTo {
+ params: TestWindowParams::new(3),
+ next_to_id: 2,
+ },
+ ];
+
+ check_ops(&ops);
+}
+
+#[test]
fn set_width_fixed_negative() {
let ops = [
Op::AddOutput(3),