don’t allow useless splits, change orientation of existing split container instead

This commit is contained in:
Michael Stapelberg 2010-11-14 23:18:39 +01:00
parent e8b5a802e2
commit 39b378b0a4
1 changed files with 5 additions and 5 deletions

View File

@ -240,11 +240,11 @@ void tree_split(Con *con, orientation_t orientation) {
Con *parent = con->parent; Con *parent = con->parent;
/* if we are in a container whose parent contains only one /* if we are in a container whose parent contains only one
* child and has the same orientation like we are trying to * child (its split functionality is unused so far), we just change the
* set, this operation is a no-op to not confuse the user */ * orientation (more intuitive than splitting again) */
if (con_orientation(parent) == orientation && if (con_num_children(parent) == 1) {
TAILQ_NEXT(con, nodes) == TAILQ_END(&(parent->nodes_head))) { parent->orientation = orientation;
DLOG("Not splitting the same way again\n"); DLOG("Just changing orientation of existing container\n");
return; return;
} }