aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-04-06 15:37:55 -0400
committerDrew DeVault <sir@cmpwn.com>2018-04-06 15:37:55 -0400
commit9109b1fd119c6fbe1c4b5de3b97d948b86f81ce0 (patch)
treec7802860b4a4dfc0e6efbacf0745ab85ef48f972
parent5ff16994c57375c9b0b842a2f63e7d15984aeadd (diff)
downloadsway-9109b1fd119c6fbe1c4b5de3b97d948b86f81ce0.zip
sway-9109b1fd119c6fbe1c4b5de3b97d948b86f81ce0.tar.gz
sway-9109b1fd119c6fbe1c4b5de3b97d948b86f81ce0.tar.bz2
Fix moving to parallel container on another output
-rw-r--r--sway/tree/layout.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index 7296423..a3bee88 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);