diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-04-06 15:37:55 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2018-04-06 15:37:55 -0400 |
commit | 9109b1fd119c6fbe1c4b5de3b97d948b86f81ce0 (patch) | |
tree | c7802860b4a4dfc0e6efbacf0745ab85ef48f972 /sway/tree | |
parent | 5ff16994c57375c9b0b842a2f63e7d15984aeadd (diff) |
Fix moving to parallel container on another output
Diffstat (limited to 'sway/tree')
-rw-r--r-- | sway/tree/layout.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/sway/tree/layout.c b/sway/tree/layout.c index 7296423b..a3bee883 100644 --- a/sway/tree/layout.c +++ b/sway/tree/layout.c @@ -244,10 +244,7 @@ static int move_offs(enum movement_direction move_dir) { /* Gets the index of the most extreme member based on the movement offset */ static int container_limit(struct sway_container *container, enum movement_direction move_dir) { - if (container->children->length == 0) { - return 0; - } - return move_offs(move_dir) < 0 ? 0 : container->children->length - 1; + return move_offs(move_dir) < 0 ? 0 : container->children->length; } /* Takes one child, sets it aside, wraps the rest of the children in a new @@ -306,7 +303,6 @@ void container_move(struct sway_container *container, container_type_to_str(current->type), current->name); int index = index_child(current); - int limit = container_limit(parent, move_dir); switch (current->type) { case C_OUTPUT: { @@ -350,7 +346,8 @@ void container_move(struct sway_container *container, case C_CONTAINER: case C_VIEW: if (is_parallel(parent->layout, move_dir)) { - if (index == limit) { + if ((index == parent->children->length - 1 && offs > 0) + || (index == 0 && offs < 0)) { if (current->parent == container->parent) { wlr_log(L_DEBUG, "Hit limit, selecting parent"); current = current->parent; @@ -408,7 +405,7 @@ void container_move(struct sway_container *container, case C_CONTAINER: if (is_parallel(sibling->layout, move_dir)) { int limit = container_limit(sibling, invert_movement(move_dir)); - limit = limit != 0 ? limit + 1 : limit; // Convert to index + wlr_log(L_DEBUG, "limit: %d", limit); wlr_log(L_DEBUG, "Reparenting container (parallel) to index %d " "(move dir: %d)", limit, move_dir); |