Fix crash when trying to split and float a dock container.

Since splitting a docking container was allowed and successful, the check
to prevent floating it fails to work. This causes a crash because the
workspace of the container cannot be determined as the dockarea is higher
up in the tree than the workspace it belongs to.

This patch extends to sanity check to nested dock containers when trying to
float a container and also disallows manually splitting a docked container
or changing its layout.

fixes #2034
This commit is contained in:
Ingo Bürk
2015-10-26 18:16:21 +01:00
parent d187214562
commit 3d6c76eb93
4 changed files with 40 additions and 16 deletions

View File

@ -448,6 +448,20 @@ bool con_is_floating(Con *con) {
return (con->floating >= FLOATING_AUTO_ON);
}
/*
* Returns true if the container is a docked container.
*
*/
bool con_is_docked(Con *con) {
if (con->parent == NULL)
return false;
if (con->parent->type == CT_DOCKAREA)
return true;
return con_is_docked(con->parent);
}
/*
* Checks if the given container is either floating or inside some floating
* container. It returns the FLOATING_CON container.