look & feel: when moving, descend if the container in target direction is a split-container
This commit is contained in:
parent
4fcd2f6e7e
commit
780b0ddbbc
28
src/tree.c
28
src/tree.c
|
@ -394,7 +394,6 @@ void tree_move(char way, orientation_t orientation) {
|
||||||
Con *old_parent = parent;
|
Con *old_parent = parent;
|
||||||
if (focused->type == CT_WORKSPACE)
|
if (focused->type == CT_WORKSPACE)
|
||||||
return;
|
return;
|
||||||
bool level_changed = false;
|
|
||||||
while (con_orientation(parent) != orientation) {
|
while (con_orientation(parent) != orientation) {
|
||||||
DLOG("need to go one level further up\n");
|
DLOG("need to go one level further up\n");
|
||||||
/* If the current parent is an output, we are at a workspace
|
/* If the current parent is an output, we are at a workspace
|
||||||
|
@ -433,12 +432,9 @@ void tree_move(char way, orientation_t orientation) {
|
||||||
if (old_focused)
|
if (old_focused)
|
||||||
con_focus(old_focused);
|
con_focus(old_focused);
|
||||||
|
|
||||||
level_changed = true;
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
parent = parent->parent;
|
parent = parent->parent;
|
||||||
level_changed = true;
|
|
||||||
}
|
}
|
||||||
Con *current = TAILQ_FIRST(&(parent->focus_head));
|
Con *current = TAILQ_FIRST(&(parent->focus_head));
|
||||||
assert(current != TAILQ_END(&(parent->focus_head)));
|
assert(current != TAILQ_END(&(parent->focus_head)));
|
||||||
|
@ -447,13 +443,14 @@ void tree_move(char way, orientation_t orientation) {
|
||||||
Con *next = current;
|
Con *next = current;
|
||||||
if (way == 'n') {
|
if (way == 'n') {
|
||||||
LOG("i would insert it after %p / %s\n", next, next->name);
|
LOG("i would insert it after %p / %s\n", next, next->name);
|
||||||
if (!level_changed) {
|
|
||||||
next = TAILQ_NEXT(next, nodes);
|
|
||||||
if (next == TAILQ_END(&(next->parent->nodes_head))) {
|
|
||||||
LOG("cannot move further to the right\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/* Have a look at the next container: If there is no next container or
|
||||||
|
* if it is a leaf node, we move the focused one left to it. However,
|
||||||
|
* for split containers, we descend into it. */
|
||||||
|
next = TAILQ_NEXT(next, nodes);
|
||||||
|
if (next == TAILQ_END(&(next->parent->nodes_head)) || con_is_leaf(next)) {
|
||||||
|
next = current;
|
||||||
|
} else {
|
||||||
/* if this is a split container, we need to go down */
|
/* if this is a split container, we need to go down */
|
||||||
while (!TAILQ_EMPTY(&(next->focus_head)))
|
while (!TAILQ_EMPTY(&(next->focus_head)))
|
||||||
next = TAILQ_FIRST(&(next->focus_head));
|
next = TAILQ_FIRST(&(next->focus_head));
|
||||||
|
@ -468,13 +465,10 @@ void tree_move(char way, orientation_t orientation) {
|
||||||
} else {
|
} else {
|
||||||
LOG("i would insert it before %p / %s\n", current, current->name);
|
LOG("i would insert it before %p / %s\n", current, current->name);
|
||||||
bool gone_down = false;
|
bool gone_down = false;
|
||||||
if (!level_changed) {
|
next = TAILQ_PREV(next, nodes_head, nodes);
|
||||||
next = TAILQ_PREV(next, nodes_head, nodes);
|
if (next == TAILQ_END(&(next->parent->nodes_head)) || con_is_leaf(next)) {
|
||||||
if (next == TAILQ_END(&(next->parent->nodes_head))) {
|
next = current;
|
||||||
LOG("cannot move further\n");
|
} else {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if this is a split container, we need to go down */
|
/* if this is a split container, we need to go down */
|
||||||
while (!TAILQ_EMPTY(&(next->focus_head))) {
|
while (!TAILQ_EMPTY(&(next->focus_head))) {
|
||||||
gone_down = true;
|
gone_down = true;
|
||||||
|
|
Loading…
Reference in New Issue