Don’t create a split container if no other cons are on a workspace (Thanks mseed)
This fixes #306.
This commit is contained in:
parent
0238ce3c73
commit
dad7c0da00
15
src/tree.c
15
src/tree.c
|
@ -396,6 +396,20 @@ void tree_move(char way, orientation_t orientation) {
|
||||||
if (TAILQ_EMPTY(&(parent->nodes_head)))
|
if (TAILQ_EMPTY(&(parent->nodes_head)))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/* Check if there are any other cons at all. If not, there is no
|
||||||
|
* point in creating a new split con and changing workspace
|
||||||
|
* orientation. Instead, the operation is a no-op. */
|
||||||
|
Con *child;
|
||||||
|
bool other_container = false;
|
||||||
|
TAILQ_FOREACH(child, &(parent->nodes_head), nodes)
|
||||||
|
if (child != focused)
|
||||||
|
other_container = true;
|
||||||
|
|
||||||
|
if (!other_container) {
|
||||||
|
DLOG("No other container found, we are not creating this split container.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* 1: create a new split container */
|
/* 1: create a new split container */
|
||||||
Con *new = con_new(NULL);
|
Con *new = con_new(NULL);
|
||||||
new->parent = parent;
|
new->parent = parent;
|
||||||
|
@ -410,7 +424,6 @@ void tree_move(char way, orientation_t orientation) {
|
||||||
|
|
||||||
/* 3: move the existing cons of this workspace below the new con */
|
/* 3: move the existing cons of this workspace below the new con */
|
||||||
DLOG("Moving cons\n");
|
DLOG("Moving cons\n");
|
||||||
Con *child;
|
|
||||||
while (!TAILQ_EMPTY(&(parent->nodes_head))) {
|
while (!TAILQ_EMPTY(&(parent->nodes_head))) {
|
||||||
child = TAILQ_FIRST(&(parent->nodes_head));
|
child = TAILQ_FIRST(&(parent->nodes_head));
|
||||||
con_detach(child);
|
con_detach(child);
|
||||||
|
|
Loading…
Reference in New Issue