Merge pull request #3204 from orestisf1993/focus_next
_con_move_to_con: focus_next isn't always con_next_focused(con)
This commit is contained in:
commit
6f4b0e1fdd
10
src/con.c
10
src/con.c
|
@ -1140,7 +1140,13 @@ static bool _con_move_to_con(Con *con, Con *target, bool behind_focused, bool fi
|
||||||
|
|
||||||
/* 1: save the container which is going to be focused after the current
|
/* 1: save the container which is going to be focused after the current
|
||||||
* container is moved away */
|
* container is moved away */
|
||||||
Con *focus_next = con_next_focused(con);
|
Con *focus_next = NULL;
|
||||||
|
if (!ignore_focus && source_ws == current_ws) {
|
||||||
|
focus_next = con_descend_focused(source_ws);
|
||||||
|
if (focus_next == con || con_has_parent(focus_next, con)) {
|
||||||
|
focus_next = con_next_focused(con);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* 2: we go up one level, but only when target is a normal container */
|
/* 2: we go up one level, but only when target is a normal container */
|
||||||
if (target->type != CT_WORKSPACE) {
|
if (target->type != CT_WORKSPACE) {
|
||||||
|
@ -1223,7 +1229,7 @@ static bool _con_move_to_con(Con *con, Con *target, bool behind_focused, bool fi
|
||||||
|
|
||||||
/* Set focus only if con was on current workspace before moving.
|
/* Set focus only if con was on current workspace before moving.
|
||||||
* Otherwise we would give focus to some window on different workspace. */
|
* Otherwise we would give focus to some window on different workspace. */
|
||||||
if (!ignore_focus && source_ws == current_ws)
|
if (focus_next)
|
||||||
con_activate(con_descend_focused(focus_next));
|
con_activate(con_descend_focused(focus_next));
|
||||||
|
|
||||||
/* 8. If anything within the container is associated with a startup sequence,
|
/* 8. If anything within the container is associated with a startup sequence,
|
||||||
|
|
|
@ -27,6 +27,7 @@ sub kill_and_confirm_focus {
|
||||||
}
|
}
|
||||||
|
|
||||||
my @windows;
|
my @windows;
|
||||||
|
my $ws;
|
||||||
|
|
||||||
sub focus_windows {
|
sub focus_windows {
|
||||||
for (my $i = $#windows; $i >= 0; $i--) {
|
for (my $i = $#windows; $i >= 0; $i--) {
|
||||||
|
@ -122,4 +123,22 @@ $windows[0] = open_window;
|
||||||
cmd '[id=' . $windows[3]->id . '] move right';
|
cmd '[id=' . $windows[3]->id . '] move right';
|
||||||
confirm_focus('split-v + unfocused move');
|
confirm_focus('split-v + unfocused move');
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# Test that moving an unfocused container from inside a split
|
||||||
|
# container to another workspace doesn't focus sibling.
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
$ws = fresh_workspace;
|
||||||
|
$windows[0] = open_window;
|
||||||
|
$windows[1] = open_window;
|
||||||
|
cmd 'split v';
|
||||||
|
open_window;
|
||||||
|
cmd 'mark a';
|
||||||
|
|
||||||
|
cmd '[id=' . $windows[0]->id . '] focus';
|
||||||
|
cmd '[con_mark=a] move to workspace ' . get_unused_workspace;
|
||||||
|
|
||||||
|
is(@{get_ws_content($ws)}, 2, 'Sanity check: marked window moved');
|
||||||
|
confirm_focus('Move unfocused window from split container');
|
||||||
|
|
||||||
done_testing;
|
done_testing;
|
||||||
|
|
Loading…
Reference in New Issue