Make workspace_layout handle all cons at workspace level, not only the first one (+test)

This makes opening new windows on workspace level and moving windows to the
right/left more like in the old i3.
This commit is contained in:
Michael Stapelberg
2011-06-02 17:21:38 +02:00
parent 51bfdbf0a8
commit 1585d942ea
13 changed files with 262 additions and 40 deletions

View File

@ -22,6 +22,23 @@ static void insert_con_into(Con *con, Con *target, position_t position) {
con_detach(con);
con_fix_percent(con->parent);
/* When moving to a workspace, we respect the users configured
* workspace_layout */
if (parent->type == CT_WORKSPACE) {
Con *split = workspace_attach_to(parent);
if (split != parent) {
DLOG("Got a new split con, using that one instead\n");
con->parent = split;
con_attach(con, split, false);
DLOG("attached\n");
con->percent = 0.0;
con_fix_percent(split);
con = split;
DLOG("ok, continuing with con %p instead\n", con);
con_detach(con);
}
}
con->parent = parent;
if (position == BEFORE) {
@ -142,7 +159,8 @@ void tree_move(int direction) {
} while (same_orientation == NULL);
/* this time, we have to move to another container */
/* This is the container *above* 'con' which is inside 'same_orientation' */
/* This is the container *above* 'con' (an ancestor of con) which is inside
* 'same_orientation' */
Con *above = con;
while (above->parent != same_orientation)
above = above->parent;