diff options
Diffstat (limited to 'sway/layout.c')
-rw-r--r-- | sway/layout.c | 55 |
1 files changed, 2 insertions, 53 deletions
diff --git a/sway/layout.c b/sway/layout.c index 29772172..cb4d6937 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include "container.h" | 8 | #include "container.h" |
9 | #include "workspace.h" | 9 | #include "workspace.h" |
10 | #include "focus.h" | 10 | #include "focus.h" |
11 | #include "output.h" | ||
11 | 12 | ||
12 | swayc_t root_container; | 13 | swayc_t root_container; |
13 | list_t *scratchpad; | 14 | list_t *scratchpad; |
@@ -480,7 +481,6 @@ void arrange_windows(swayc_t *container, double width, double height) { | |||
480 | 481 | ||
481 | swayc_t *get_swayc_in_direction_under(swayc_t *container, enum movement_direction dir, swayc_t *limit) { | 482 | swayc_t *get_swayc_in_direction_under(swayc_t *container, enum movement_direction dir, swayc_t *limit) { |
482 | swayc_t *parent = container->parent; | 483 | swayc_t *parent = container->parent; |
483 | |||
484 | if (dir == MOVE_PARENT) { | 484 | if (dir == MOVE_PARENT) { |
485 | if (parent->type == C_OUTPUT) { | 485 | if (parent->type == C_OUTPUT) { |
486 | return NULL; | 486 | return NULL; |
@@ -492,60 +492,9 @@ swayc_t *get_swayc_in_direction_under(swayc_t *container, enum movement_directio | |||
492 | // Test if we can even make a difference here | 492 | // Test if we can even make a difference here |
493 | bool can_move = false; | 493 | bool can_move = false; |
494 | int diff = 0; | 494 | int diff = 0; |
495 | int i; | ||
496 | if (parent->type == C_ROOT) { | 495 | if (parent->type == C_ROOT) { |
497 | // Find the next output | ||
498 | int target = -1, max_x = 0, max_y = 0, self = -1; | ||
499 | sway_log(L_DEBUG, "Moving between outputs"); | 496 | sway_log(L_DEBUG, "Moving between outputs"); |
500 | 497 | return swayc_adjacent_output(container, dir); | |
501 | for (i = 0; i < parent->children->length; ++i) { | ||
502 | swayc_t *next = parent->children->items[i]; | ||
503 | if (next == container) { | ||
504 | self = i; | ||
505 | sway_log(L_DEBUG, "self is %p %d", next, self); | ||
506 | continue; | ||
507 | } | ||
508 | if (next->type == C_OUTPUT) { | ||
509 | sway_log(L_DEBUG, "Testing with %p %d (dir %d)", next, i, dir); | ||
510 | // Check if it's more extreme | ||
511 | if (dir == MOVE_RIGHT) { | ||
512 | if (container->x + container->width <= next->x) { | ||
513 | if (target == -1 || next->x < max_x) { | ||
514 | target = i; | ||
515 | max_x = next->x; | ||
516 | } | ||
517 | } | ||
518 | } else if (dir == MOVE_LEFT) { | ||
519 | if (container->x >= next->x + next->width) { | ||
520 | if (target == -1 || max_x < next->x) { | ||
521 | target = i; | ||
522 | max_x = next->x; | ||
523 | } | ||
524 | } | ||
525 | } else if (dir == MOVE_DOWN) { | ||
526 | if (container->y + container->height <= next->y) { | ||
527 | if (target == -1 || next->y < max_y) { | ||
528 | target = i; | ||
529 | max_y = next->y; | ||
530 | } | ||
531 | } | ||
532 | } else if (dir == MOVE_UP) { | ||
533 | if (container->y >= next->y + next->height) { | ||
534 | if (target == -1 || max_y < next->y) { | ||
535 | target = i; | ||
536 | max_y = next->y; | ||
537 | } | ||
538 | } | ||
539 | } | ||
540 | } | ||
541 | } | ||
542 | |||
543 | if (target == -1) { | ||
544 | can_move = false; | ||
545 | } else { | ||
546 | can_move = true; | ||
547 | diff = target - self; | ||
548 | } | ||
549 | } else { | 498 | } else { |
550 | if (dir == MOVE_LEFT || dir == MOVE_RIGHT) { | 499 | if (dir == MOVE_LEFT || dir == MOVE_RIGHT) { |
551 | if (parent->layout == L_HORIZ) { | 500 | if (parent->layout == L_HORIZ) { |