Implement focus switching (focus left/right) for floating windows
Fixes: #475
This commit is contained in:
parent
fe35c80741
commit
172f3563f7
33
src/tree.c
33
src/tree.c
|
@ -421,13 +421,36 @@ static bool _tree_next(Con *con, char way, orientation_t orientation, bool wrap)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (con->type == CT_FLOATING_CON) {
|
||||
/* TODO: implement focus for floating windows */
|
||||
return false;
|
||||
}
|
||||
|
||||
Con *parent = con->parent;
|
||||
|
||||
if (con->type == CT_FLOATING_CON) {
|
||||
/* left/right focuses the previous/next floating container */
|
||||
if (orientation == HORIZ) {
|
||||
Con *next;
|
||||
if (way == 'n')
|
||||
next = TAILQ_NEXT(con, floating_windows);
|
||||
else next = TAILQ_PREV(con, floating_head, floating_windows);
|
||||
|
||||
/* If there is no next/previous container, wrap */
|
||||
if (!next) {
|
||||
if (way == 'n')
|
||||
next = TAILQ_FIRST(&(parent->floating_head));
|
||||
else next = TAILQ_LAST(&(parent->floating_head), floating_head);
|
||||
}
|
||||
|
||||
/* Still no next/previous container? bail out */
|
||||
if (!next)
|
||||
return false;
|
||||
|
||||
con_focus(con_descend_focused(next));
|
||||
return true;
|
||||
} else {
|
||||
/* up/down cycles through the Z-index */
|
||||
/* TODO: implement cycling through the z-index */
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* If the orientation does not match or there is no other con to focus, we
|
||||
* need to go higher in the hierarchy */
|
||||
if (con_orientation(parent) != orientation ||
|
||||
|
|
Loading…
Reference in New Issue