diff options
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r-- | sway/tree/container.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index 10d621b4..3c8e2780 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -1410,6 +1410,28 @@ void container_replace(struct sway_container *container, | |||
1410 | 1410 | ||
1411 | struct sway_container *container_split(struct sway_container *child, | 1411 | struct sway_container *container_split(struct sway_container *child, |
1412 | enum sway_container_layout layout) { | 1412 | enum sway_container_layout layout) { |
1413 | // i3 doesn't split singleton H/V containers | ||
1414 | // https://github.com/i3/i3/blob/3cd1c45eba6de073bc4300eebb4e1cc1a0c4479a/src/tree.c#L354 | ||
1415 | if (child->parent || child->workspace) { | ||
1416 | list_t *siblings = container_get_siblings(child); | ||
1417 | if (siblings->length == 1) { | ||
1418 | enum sway_container_layout current = container_parent_layout(child); | ||
1419 | if (container_is_floating(child)) { | ||
1420 | current = L_NONE; | ||
1421 | } | ||
1422 | if (current == L_HORIZ || current == L_VERT) { | ||
1423 | if (child->parent) { | ||
1424 | child->parent->layout = layout; | ||
1425 | container_update_representation(child->parent); | ||
1426 | } else { | ||
1427 | child->workspace->layout = layout; | ||
1428 | workspace_update_representation(child->workspace); | ||
1429 | } | ||
1430 | return child; | ||
1431 | } | ||
1432 | } | ||
1433 | } | ||
1434 | |||
1413 | struct sway_seat *seat = input_manager_get_default_seat(); | 1435 | struct sway_seat *seat = input_manager_get_default_seat(); |
1414 | bool set_focus = (seat_get_focus(seat) == &child->node); | 1436 | bool set_focus = (seat_get_focus(seat) == &child->node); |
1415 | 1437 | ||