aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sway/tree/container.c6
-rw-r--r--sway/tree/workspace.c3
2 files changed, 7 insertions, 2 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 11ed4f98..c4d21f0a 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -1385,8 +1385,10 @@ void container_replace(struct sway_container *container,
1385 root_scratchpad_show(container); 1385 root_scratchpad_show(container);
1386 root_scratchpad_remove_container(container); 1386 root_scratchpad_remove_container(container);
1387 } 1387 }
1388 container_add_sibling(container, replacement, 1); 1388 if (container->parent || container->workspace) {
1389 container_detach(container); 1389 container_add_sibling(container, replacement, 1);
1390 container_detach(container);
1391 }
1390 if (scratchpad) { 1392 if (scratchpad) {
1391 root_scratchpad_add_container(replacement); 1393 root_scratchpad_add_container(replacement);
1392 } 1394 }
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index 68a55e03..1a1f5c49 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -688,6 +688,9 @@ void workspace_insert_tiling(struct sway_workspace *workspace,
688 if (con->workspace) { 688 if (con->workspace) {
689 container_detach(con); 689 container_detach(con);
690 } 690 }
691 if (workspace->layout == L_STACKED || workspace->layout == L_TABBED) {
692 con = container_split(con, workspace->layout);
693 }
691 list_insert(workspace->tiling, index, con); 694 list_insert(workspace->tiling, index, con);
692 con->workspace = workspace; 695 con->workspace = workspace;
693 container_for_each_child(con, set_workspace, NULL); 696 container_for_each_child(con, set_workspace, NULL);