Bugfix: Even when not going one level up, we need to travel down the whole focus stack

This commit is contained in:
Michael Stapelberg 2010-07-17 15:08:22 +02:00
parent 21c45418b3
commit 189635a5dc
1 changed files with 8 additions and 7 deletions

View File

@ -418,14 +418,15 @@ Con *con_next_focused(Con *con) {
/* try to focus the next container on the same level as this one */ /* try to focus the next container on the same level as this one */
next = TAILQ_NEXT(con, focused); next = TAILQ_NEXT(con, focused);
/* if none, go up to its parent and go down the focus stack as far as /* if that was not possible, go up to its parent */
* possible, excluding the current container */ if (next == TAILQ_END(&(parent->nodes_head)))
if (next == TAILQ_END(&(parent->nodes_head))) {
next = con->parent; next = con->parent;
while (!TAILQ_EMPTY(&(next->focus_head)) &&
TAILQ_FIRST(&(next->focus_head)) != con) /* now go down the focus stack as far as
next = TAILQ_FIRST(&(next->focus_head)); * possible, excluding the current container */
} while (!TAILQ_EMPTY(&(next->focus_head)) &&
TAILQ_FIRST(&(next->focus_head)) != con)
next = TAILQ_FIRST(&(next->focus_head));
return next; return next;
} }