diff options
author | Tony Crisci <tony@dubstepdish.com> | 2018-02-17 19:03:21 -0500 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2018-02-17 19:03:21 -0500 |
commit | 176d24f02dfaa0a7866dd4ea278d0cbf30fa23bb (patch) | |
tree | e1e8fd973a2e2cc598a5924768394962c86b1daf | |
parent | basic move focus in direction across outputs (diff) | |
download | sway-176d24f02dfaa0a7866dd4ea278d0cbf30fa23bb.tar.gz sway-176d24f02dfaa0a7866dd4ea278d0cbf30fa23bb.tar.zst sway-176d24f02dfaa0a7866dd4ea278d0cbf30fa23bb.zip |
choose adjacent container between outputs
-rw-r--r-- | sway/tree/layout.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/sway/tree/layout.c b/sway/tree/layout.c index 6a574303..be494791 100644 --- a/sway/tree/layout.c +++ b/sway/tree/layout.c | |||
@@ -364,7 +364,12 @@ static swayc_t *get_swayc_in_output_direction(swayc_t *output, | |||
364 | ws = swayc_parent_by_type(ws, C_WORKSPACE); | 364 | ws = swayc_parent_by_type(ws, C_WORKSPACE); |
365 | } | 365 | } |
366 | 366 | ||
367 | if (ws && ws->children->length > 0) { | 367 | if (ws == NULL) { |
368 | wlr_log(L_ERROR, "got an output without a workspace"); | ||
369 | return NULL; | ||
370 | } | ||
371 | |||
372 | if (ws->children->length > 0) { | ||
368 | switch (dir) { | 373 | switch (dir) { |
369 | case MOVE_LEFT: | 374 | case MOVE_LEFT: |
370 | // get most right child of new output | 375 | // get most right child of new output |
@@ -395,7 +400,7 @@ static swayc_t *get_swayc_in_output_direction(swayc_t *output, | |||
395 | } | 400 | } |
396 | } | 401 | } |
397 | 402 | ||
398 | return output; | 403 | return ws; |
399 | } | 404 | } |
400 | 405 | ||
401 | static void get_layout_center_position(swayc_t *container, int *x, int *y) { | 406 | static void get_layout_center_position(swayc_t *container, int *x, int *y) { |
@@ -525,12 +530,13 @@ static swayc_t *get_swayc_in_direction_under(swayc_t *container, | |||
525 | if (!adjacent || adjacent == container) { | 530 | if (!adjacent || adjacent == container) { |
526 | return wrap_candidate; | 531 | return wrap_candidate; |
527 | } | 532 | } |
528 | // TODO descend into the focus-inactive of the physically closest | 533 | swayc_t *next = get_swayc_in_output_direction(adjacent, dir, seat); |
529 | // view of the output | 534 | if (next->children->length) { |
530 | //swayc_t *new_con = get_swayc_in_output_direction(adjacent, dir, seat); | 535 | // TODO consider floating children as well |
531 | swayc_t *new_con = sway_seat_get_focus_inactive(seat, adjacent); | 536 | return sway_seat_get_focus_inactive(seat, next); |
532 | return new_con; | 537 | } else { |
533 | 538 | return next; | |
539 | } | ||
534 | } else { | 540 | } else { |
535 | if (dir == MOVE_LEFT || dir == MOVE_RIGHT) { | 541 | if (dir == MOVE_LEFT || dir == MOVE_RIGHT) { |
536 | if (parent->layout == L_HORIZ || parent->layout == L_TABBED) { | 542 | if (parent->layout == L_HORIZ || parent->layout == L_TABBED) { |