diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2018-05-27 23:20:21 -0400 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2018-05-27 23:20:21 -0400 |
commit | 46da1dc32bd6c101964d32bb698e8187fb9ee91e (patch) | |
tree | e713b194254bf6d43214a394459c1b94e64bbacb /sway/tree | |
parent | b2c0ba5b180b75a18e622934bbed61b0f14b1661 (diff) | |
download | sway-46da1dc32bd6c101964d32bb698e8187fb9ee91e.tar.xz |
Implement focus_wrapping
Diffstat (limited to 'sway/tree')
-rw-r--r-- | sway/tree/layout.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/sway/tree/layout.c b/sway/tree/layout.c index 624d5516..6d76ae0f 100644 --- a/sway/tree/layout.c +++ b/sway/tree/layout.c @@ -708,7 +708,10 @@ struct sway_container *container_get_in_direction( sway_output_from_wlr(wlr_adjacent); if (!adjacent || adjacent == container) { - return wrap_candidate; + if (!wrap_candidate) { + return NULL; + } + return seat_get_focus_inactive_view(seat, wrap_candidate); } struct sway_container *next = get_swayc_in_output_direction(adjacent, dir, seat); @@ -748,23 +751,25 @@ struct sway_container *container_get_in_direction( if (desired < 0 || desired >= parent->children->length) { can_move = false; int len = parent->children->length; - if (!wrap_candidate && len > 1) { + if (config->focus_wrapping != WRAP_NO && !wrap_candidate + && len > 1) { if (desired < 0) { wrap_candidate = parent->children->items[len-1]; } else { wrap_candidate = parent->children->items[0]; } - if (config->force_focus_wrapping) { - return wrap_candidate; + if (config->focus_wrapping == WRAP_FORCE) { + return seat_get_focus_inactive_view(seat, + wrap_candidate); } } } else { - struct sway_container *desired_con = parent->children->items[desired]; + struct sway_container *desired_con = + parent->children->items[desired]; wlr_log(L_DEBUG, "cont %d-%p dir %i sibling %d: %p", idx, container, dir, desired, desired_con); - struct sway_container *next = seat_get_focus_inactive_view(seat, desired_con); - return next; + return seat_get_focus_inactive_view(seat, desired_con); } } @@ -773,7 +778,10 @@ struct sway_container *container_get_in_direction( parent = parent->parent; if (!parent) { // wrapping is the last chance - return wrap_candidate; + if (!wrap_candidate) { + return NULL; + } + return seat_get_focus_inactive_view(seat, wrap_candidate); } } } |