*/
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;
}
Con *next = con;
Con *before;
Con *child;
+ if (next == focused)
+ return next;
do {
before = next;
TAILQ_FOREACH(child, &(next->focus_head), focused) {
next = child;
break;
}
- } while (before != next);
+ } while (before != next && next != focused);
return next;
}