Bugfix: Correctly attach floating Cons to a different workspace, extend testcase
This commit is contained in:
parent
613866dbc0
commit
0f0d01336b
33
src/con.c
33
src/con.c
|
@ -106,22 +106,27 @@ void con_attach(Con *con, Con *parent, bool ignore_focus) {
|
||||||
goto add_to_focus_head;
|
goto add_to_focus_head;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ignore_focus) {
|
if (con->type == CT_FLOATING_CON) {
|
||||||
/* Get the first tiling container in focus stack */
|
DLOG("Inserting into floating containers\n");
|
||||||
TAILQ_FOREACH(loop, &(parent->focus_head), focused) {
|
TAILQ_INSERT_TAIL(&(parent->floating_head), con, floating_windows);
|
||||||
if (loop->type == CT_FLOATING_CON)
|
} else {
|
||||||
continue;
|
if (!ignore_focus) {
|
||||||
current = loop;
|
/* Get the first tiling container in focus stack */
|
||||||
break;
|
TAILQ_FOREACH(loop, &(parent->focus_head), focused) {
|
||||||
|
if (loop->type == CT_FLOATING_CON)
|
||||||
|
continue;
|
||||||
|
current = loop;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Insert the container after the tiling container, if found */
|
/* Insert the container after the tiling container, if found */
|
||||||
if (current) {
|
if (current) {
|
||||||
DLOG("Inserting con = %p after last focused tiling con %p\n",
|
DLOG("Inserting con = %p after last focused tiling con %p\n",
|
||||||
con, current);
|
con, current);
|
||||||
TAILQ_INSERT_AFTER(nodes_head, current, con, nodes);
|
TAILQ_INSERT_AFTER(nodes_head, current, con, nodes);
|
||||||
} else TAILQ_INSERT_TAIL(nodes_head, con, nodes);
|
} else TAILQ_INSERT_TAIL(nodes_head, con, nodes);
|
||||||
|
}
|
||||||
|
|
||||||
add_to_focus_head:
|
add_to_focus_head:
|
||||||
/* We insert to the TAIL because con_focus() will correct this.
|
/* We insert to the TAIL because con_focus() will correct this.
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#
|
#
|
||||||
# Checks if the 'move workspace' command works correctly
|
# Checks if the 'move workspace' command works correctly
|
||||||
#
|
#
|
||||||
use i3test tests => 7;
|
use i3test tests => 11;
|
||||||
use Time::HiRes qw(sleep);
|
use Time::HiRes qw(sleep);
|
||||||
|
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3("/tmp/nestedcons");
|
||||||
|
@ -38,4 +38,26 @@ is($focus->[0], $second, 'same container on different ws');
|
||||||
($nodes, $focus) = get_ws_content($tmp);
|
($nodes, $focus) = get_ws_content($tmp);
|
||||||
is($nodes->[0]->{focused}, 1, 'first container focused on first ws');
|
is($nodes->[0]->{focused}, 1, 'first container focused on first ws');
|
||||||
|
|
||||||
|
###################################################################
|
||||||
|
# check if floating cons are moved to new workspaces properly
|
||||||
|
# (that is, if they are floating on the target ws, too)
|
||||||
|
###################################################################
|
||||||
|
|
||||||
|
$tmp = get_unused_workspace();
|
||||||
|
$tmp2 = get_unused_workspace();
|
||||||
|
cmd "workspace $tmp";
|
||||||
|
|
||||||
|
cmd "open";
|
||||||
|
cmd "mode toggle";
|
||||||
|
|
||||||
|
my $ws = get_ws($tmp);
|
||||||
|
is(@{$ws->{nodes}}, 0, 'no nodes on workspace');
|
||||||
|
is(@{$ws->{floating_nodes}}, 1, 'one floating node on workspace');
|
||||||
|
|
||||||
|
cmd "move workspace $tmp2";
|
||||||
|
|
||||||
|
$ws = get_ws($tmp2);
|
||||||
|
is(@{$ws->{nodes}}, 0, 'no nodes on workspace');
|
||||||
|
is(@{$ws->{floating_nodes}}, 1, 'one floating node on workspace');
|
||||||
|
|
||||||
diag( "Testing i3, Perl $], $^X" );
|
diag( "Testing i3, Perl $], $^X" );
|
||||||
|
|
Loading…
Reference in New Issue