Implement tree flattening to automatically solve situations of redundant chains of split containers

This should fix the move problems. See comment of tree_flatten() for a little
example.
This commit is contained in:
Michael Stapelberg
2011-01-07 22:21:41 +01:00
parent 228b5c51ff
commit 115462f103
4 changed files with 146 additions and 0 deletions

View File

@ -84,4 +84,19 @@ void tree_close(Con *con, bool kill_window, bool dont_kill_parent);
*/
bool tree_restore(const char *path);
/**
* tree_flatten() removes pairs of redundant split containers, e.g.:
* [workspace, horizontal]
* [v-split] [child3]
* [h-split]
* [child1] [child2]
* In this example, the v-split and h-split container are redundant.
* Such a situation can be created by moving containers in a direction which is
* not the orientation of their parent container. i3 needs to create a new
* split container then and if you move containers this way multiple times,
* redundant chains of split-containers can be the result.
*
*/
void tree_flatten(Con *child);
#endif