aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/layout.c
diff options
context:
space:
mode:
authorLibravatar Tony Crisci <tony@dubstepdish.com>2018-02-17 19:03:21 -0500
committerLibravatar Tony Crisci <tony@dubstepdish.com>2018-02-17 19:03:21 -0500
commit176d24f02dfaa0a7866dd4ea278d0cbf30fa23bb (patch)
treee1e8fd973a2e2cc598a5924768394962c86b1daf /sway/tree/layout.c
parentbasic move focus in direction across outputs (diff)
downloadsway-176d24f02dfaa0a7866dd4ea278d0cbf30fa23bb.tar.gz
sway-176d24f02dfaa0a7866dd4ea278d0cbf30fa23bb.tar.zst
sway-176d24f02dfaa0a7866dd4ea278d0cbf30fa23bb.zip
choose adjacent container between outputs
Diffstat (limited to 'sway/tree/layout.c')
-rw-r--r--sway/tree/layout.c22
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
401static void get_layout_center_position(swayc_t *container, int *x, int *y) { 406static 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) {