X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fcon.c;fp=src%2Fcon.c;h=ded8d7bf0596859aedc47f872c634d552267a31d;hb=470ee00012ccb05db9e0255a38376bffa25dd9b2;hp=f90d569f61c09717396705470c51cc46443b7a3b;hpb=634512404940fb4b1effc930feb8b108883cef60;p=i3%2Fi3 diff --git a/src/con.c b/src/con.c index f90d569f..ded8d7bf 100644 --- a/src/con.c +++ b/src/con.c @@ -810,7 +810,7 @@ Con *con_get_next(Con *con, char way, orientation_t orientation) { */ Con *con_descend_focused(Con *con) { Con *next = con; - while (!TAILQ_EMPTY(&(next->focus_head))) + while (next != focused && !TAILQ_EMPTY(&(next->focus_head))) next = TAILQ_FIRST(&(next->focus_head)); return next; } @@ -827,6 +827,8 @@ Con *con_descend_tiling_focused(Con *con) { Con *next = con; Con *before; Con *child; + if (next == focused) + return next; do { before = next; TAILQ_FOREACH(child, &(next->focus_head), focused) { @@ -836,7 +838,7 @@ Con *con_descend_tiling_focused(Con *con) { next = child; break; } - } while (before != next); + } while (before != next && next != focused); return next; }