aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sway/commands/move.c10
-rw-r--r--sway/tree/container.c8
2 files changed, 14 insertions, 4 deletions
diff --git a/sway/commands/move.c b/sway/commands/move.c
index 5851520e..03839083 100644
--- a/sway/commands/move.c
+++ b/sway/commands/move.c
@@ -275,12 +275,11 @@ static void workspace_rejigger(struct sway_workspace *ws,
275 return; 275 return;
276 } 276 }
277 container_detach(child); 277 container_detach(child);
278 struct sway_container *new_parent = workspace_wrap_children(ws); 278 workspace_wrap_children(ws);
279 279
280 int index = 280 int index =
281 move_dir == WLR_DIRECTION_LEFT || move_dir == WLR_DIRECTION_UP ? 0 : 1; 281 move_dir == WLR_DIRECTION_LEFT || move_dir == WLR_DIRECTION_UP ? 0 : 1;
282 workspace_insert_tiling(ws, child, index); 282 workspace_insert_tiling(ws, child, index);
283 container_flatten(new_parent);
284 ws->layout = 283 ws->layout =
285 move_dir == WLR_DIRECTION_LEFT || move_dir == WLR_DIRECTION_RIGHT ? 284 move_dir == WLR_DIRECTION_LEFT || move_dir == WLR_DIRECTION_RIGHT ?
286 L_HORIZ : L_VERT; 285 L_HORIZ : L_VERT;
@@ -349,8 +348,11 @@ static bool container_move_in_direction(struct sway_container *container,
349 container_insert_child(current->parent, container, 348 container_insert_child(current->parent, container,
350 index + (offs < 0 ? 0 : 1)); 349 index + (offs < 0 ? 0 : 1));
351 } else { 350 } else {
352 workspace_insert_tiling(current->workspace, container, 351 struct sway_workspace *ws = current->workspace;
353 index + (offs < 0 ? 0 : 1)); 352 workspace_insert_tiling(ws,
353 container_split(container,
354 output_get_default_layout(ws->output)),
355 index + (offs < 0 ? 0 : 1));
354 } 356 }
355 return true; 357 return true;
356 } 358 }
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 4cc42747..fa1598ef 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -1329,6 +1329,14 @@ void container_detach(struct sway_container *child) {
1329 container_update_representation(old_parent); 1329 container_update_representation(old_parent);
1330 node_set_dirty(&old_parent->node); 1330 node_set_dirty(&old_parent->node);
1331 } else if (old_workspace) { 1331 } else if (old_workspace) {
1332 // We may have removed the last tiling child from the workspace. If the
1333 // workspace layout was e.g. tabbed, then at this point it may be just
1334 // H[]. So, reset it to the default (e.g. T[]) for next time.
1335 if (!old_workspace->tiling->length) {
1336 old_workspace->layout =
1337 output_get_default_layout(old_workspace->output);
1338 }
1339
1332 workspace_update_representation(old_workspace); 1340 workspace_update_representation(old_workspace);
1333 node_set_dirty(&old_workspace->node); 1341 node_set_dirty(&old_workspace->node);
1334 } 1342 }