aboutsummaryrefslogtreecommitdiff
path: root/sway/tree/layout.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree/layout.c')
-rw-r--r--sway/tree/layout.c44
1 files changed, 31 insertions, 13 deletions
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index f8acdf6c..21cec529 100644
--- a/sway/tree/layout.c
+++ b/sway/tree/layout.c
@@ -149,7 +149,7 @@ struct sway_container *container_remove_child(struct sway_container *child) {
}
}
child->parent = NULL;
- container_notify_child_title_changed(parent);
+ container_notify_subtree_changed(parent);
return parent;
}
@@ -184,12 +184,20 @@ void container_move_to(struct sway_container *container,
container_sort_workspaces(new_parent);
seat_set_focus(seat, new_parent);
}
- container_notify_child_title_changed(old_parent);
- container_notify_child_title_changed(new_parent);
+ container_notify_subtree_changed(old_parent);
+ container_notify_subtree_changed(new_parent);
if (old_parent) {
- arrange_children_of(old_parent);
+ if (old_parent->type == C_OUTPUT) {
+ arrange_output(old_parent);
+ } else {
+ arrange_children_of(old_parent);
+ }
+ }
+ if (new_parent->type == C_OUTPUT) {
+ arrange_output(new_parent);
+ } else {
+ arrange_children_of(new_parent);
}
- arrange_children_of(new_parent);
// If view was moved to a fullscreen workspace, refocus the fullscreen view
struct sway_container *new_workspace = container;
if (new_workspace->type != C_WORKSPACE) {
@@ -319,9 +327,11 @@ void container_move(struct sway_container *container,
current = container_parent(container, C_OUTPUT);
}
- if (parent != container_flatten(parent)) {
+ struct sway_container *new_parent = container_flatten(parent);
+ if (new_parent != parent) {
// Special case: we were the last one in this container, so flatten it
// and leave
+ arrange_children_of(new_parent);
update_debug_tree();
return;
}
@@ -489,8 +499,8 @@ void container_move(struct sway_container *container,
}
}
- container_notify_child_title_changed(old_parent);
- container_notify_child_title_changed(container->parent);
+ container_notify_subtree_changed(old_parent);
+ container_notify_subtree_changed(container->parent);
if (old_parent) {
seat_set_focus(config->handler_context.seat, old_parent);
@@ -578,11 +588,19 @@ static struct sway_container *get_swayc_in_output_direction(
if (ws->children->length > 0) {
switch (dir) {
case MOVE_LEFT:
- // get most right child of new output
- return ws->children->items[ws->children->length-1];
+ if (ws->layout == L_HORIZ || ws->layout == L_TABBED) {
+ // get most right child of new output
+ return ws->children->items[ws->children->length-1];
+ } else {
+ return seat_get_focus_inactive(seat, ws);
+ }
case MOVE_RIGHT:
- // get most left child of new output
- return ws->children->items[0];
+ if (ws->layout == L_HORIZ || ws->layout == L_TABBED) {
+ // get most left child of new output
+ return ws->children->items[0];
+ } else {
+ return seat_get_focus_inactive(seat, ws);
+ }
case MOVE_UP:
case MOVE_DOWN: {
struct sway_container *focused =
@@ -839,7 +857,7 @@ struct sway_container *container_split(struct sway_container *child,
container_add_child(cont, child);
}
- container_notify_child_title_changed(cont);
+ container_notify_subtree_changed(cont);
return cont;
}