Allow workspace contents to be moved if there are only floating children
This commit is contained in:
24
src/con.c
24
src/con.c
@ -232,6 +232,14 @@ bool con_is_leaf(Con *con) {
|
||||
return TAILQ_EMPTY(&(con->nodes_head));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this node has regular or floating children.
|
||||
*
|
||||
*/
|
||||
bool con_has_children(Con *con) {
|
||||
return (!con_is_leaf(con) || !TAILQ_EMPTY(&(con->floating_head)));
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns true if a container should be considered split.
|
||||
*
|
||||
@ -643,18 +651,22 @@ void con_move_to_workspace(Con *con, Con *workspace, bool fix_coordinates, bool
|
||||
}
|
||||
|
||||
if (con->type == CT_WORKSPACE) {
|
||||
con = workspace_encapsulate(con);
|
||||
if (con == NULL) {
|
||||
ELOG("Workspace failed to move its contents into a container!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Re-parent all of the old workspace's floating windows. */
|
||||
Con *child;
|
||||
while (!TAILQ_EMPTY(&(source_ws->floating_head))) {
|
||||
child = TAILQ_FIRST(&(source_ws->floating_head));
|
||||
con_move_to_workspace(child, workspace, true, true);
|
||||
}
|
||||
|
||||
/* If there are no non-floating children, ignore the workspace. */
|
||||
if (con_is_leaf(con))
|
||||
return;
|
||||
|
||||
con = workspace_encapsulate(con);
|
||||
if (con == NULL) {
|
||||
ELOG("Workspace failed to move its contents into a container!\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Save the current workspace. So we can call workspace_show() by the end
|
||||
|
Reference in New Issue
Block a user