look & feel: when moving, descend if the container in target direction is a split-container

This commit is contained in:
Michael Stapelberg 2010-11-28 18:35:11 +01:00
parent 4fcd2f6e7e
commit 780b0ddbbc
1 changed files with 11 additions and 17 deletions

View File

@ -394,7 +394,6 @@ void tree_move(char way, orientation_t orientation) {
Con *old_parent = parent;
if (focused->type == CT_WORKSPACE)
return;
bool level_changed = false;
while (con_orientation(parent) != orientation) {
DLOG("need to go one level further up\n");
/* 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)
con_focus(old_focused);
level_changed = true;
break;
}
parent = parent->parent;
level_changed = true;
}
Con *current = TAILQ_FIRST(&(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;
if (way == 'n') {
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 */
while (!TAILQ_EMPTY(&(next->focus_head)))
next = TAILQ_FIRST(&(next->focus_head));
@ -468,13 +465,10 @@ void tree_move(char way, orientation_t orientation) {
} else {
LOG("i would insert it before %p / %s\n", current, current->name);
bool gone_down = false;
if (!level_changed) {
next = TAILQ_PREV(next, nodes_head, nodes);
if (next == TAILQ_END(&(next->parent->nodes_head))) {
LOG("cannot move further\n");
return;
}
next = TAILQ_PREV(next, nodes_head, 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 */
while (!TAILQ_EMPTY(&(next->focus_head))) {
gone_down = true;