tree_move: Don't change focus order when swapping containers
The call to ewmh_update_wm_desktop is removed since the change happens under the same parent.
This commit is contained in:
parent
9380a75186
commit
11dd2dbc66
19
src/move.c
19
src/move.c
|
@ -298,9 +298,10 @@ void tree_move(Con *con, int direction) {
|
||||||
|
|
||||||
/* easy case: the move is within this container */
|
/* easy case: the move is within this container */
|
||||||
if (same_orientation == con->parent) {
|
if (same_orientation == con->parent) {
|
||||||
DLOG("We are in the same container\n");
|
Con *swap = (direction == D_LEFT || direction == D_UP)
|
||||||
Con *swap;
|
? TAILQ_PREV(con, nodes_head, nodes)
|
||||||
if ((swap = (direction == D_LEFT || direction == D_UP ? TAILQ_PREV(con, nodes_head, nodes) : TAILQ_NEXT(con, nodes)))) {
|
: TAILQ_NEXT(con, nodes);
|
||||||
|
if (swap) {
|
||||||
if (!con_is_leaf(swap)) {
|
if (!con_is_leaf(swap)) {
|
||||||
DLOG("Moving into our bordering branch\n");
|
DLOG("Moving into our bordering branch\n");
|
||||||
target = con_descend_direction(swap, direction);
|
target = con_descend_direction(swap, direction);
|
||||||
|
@ -312,17 +313,15 @@ void tree_move(Con *con, int direction) {
|
||||||
insert_con_into(con, target, position);
|
insert_con_into(con, target, position);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if (direction == D_LEFT || direction == D_UP)
|
|
||||||
|
DLOG("Swapping with sibling.\n");
|
||||||
|
if (direction == D_LEFT || direction == D_UP) {
|
||||||
TAILQ_SWAP(swap, con, &(swap->parent->nodes_head), nodes);
|
TAILQ_SWAP(swap, con, &(swap->parent->nodes_head), nodes);
|
||||||
else
|
} else {
|
||||||
TAILQ_SWAP(con, swap, &(swap->parent->nodes_head), nodes);
|
TAILQ_SWAP(con, swap, &(swap->parent->nodes_head), nodes);
|
||||||
|
}
|
||||||
|
|
||||||
TAILQ_REMOVE(&(con->parent->focus_head), con, focused);
|
|
||||||
TAILQ_INSERT_HEAD(&(swap->parent->focus_head), con, focused);
|
|
||||||
|
|
||||||
DLOG("Swapped.\n");
|
|
||||||
ipc_send_window_event("move", con);
|
ipc_send_window_event("move", con);
|
||||||
ewmh_update_wm_desktop();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,6 +125,22 @@ $windows[0] = open_window;
|
||||||
cmd '[id=' . $windows[3]->id . '] move right';
|
cmd '[id=' . $windows[3]->id . '] move right';
|
||||||
confirm_focus('unfocused move from other output');
|
confirm_focus('unfocused move from other output');
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
# Test that moving an unfocused container inside its original parent
|
||||||
|
# maintains the correct focus order.
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
fresh_workspace;
|
||||||
|
$windows[0] = open_window;
|
||||||
|
$windows[1] = open_window;
|
||||||
|
cmd 'split v';
|
||||||
|
$windows[2] = open_window;
|
||||||
|
$windows[3] = open_window;
|
||||||
|
focus_windows;
|
||||||
|
|
||||||
|
cmd '[id=' . $windows[2]->id . '] move up';
|
||||||
|
confirm_focus('split-v + unfocused move inside parent');
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# Test that moving an unfocused container maintains the correct focus
|
# Test that moving an unfocused container maintains the correct focus
|
||||||
# order.
|
# order.
|
||||||
|
|
Loading…
Reference in New Issue