diff options
author | emersion <contact@emersion.fr> | 2018-05-28 10:30:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-28 10:30:11 +0100 |
commit | 1071785f56676218a059e4d6fa10def630e5129b (patch) | |
tree | f3ec325fc9e67af920c94454e2f6f2a5766d8b88 /sway/tree | |
parent | 015878e5db5df2fa36c3d5783661e56d5f10c100 (diff) | |
parent | 46da1dc32bd6c101964d32bb698e8187fb9ee91e (diff) | |
download | sway-1071785f56676218a059e4d6fa10def630e5129b.tar.xz |
Merge pull request #2060 from RedSoxFan/focus-wrapping
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 aca9e254..1507eba9 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); } } } |