Bugfix: Fix floating assignments, extend test for the assign command (Thanks Tucos)

This commit is contained in:
Michael Stapelberg 2011-06-13 17:42:59 +02:00
parent 49f1c2d8ca
commit e5c811248f
2 changed files with 48 additions and 2 deletions

View File

@ -692,7 +692,7 @@ assign:
if (*workspace == '\0') { if (*workspace == '\0') {
/* This assignment was *only* for floating */ /* This assignment was *only* for floating */
assignment->type = A_COMMAND; assignment->type = A_COMMAND;
assignment->dest.command = sstrdup("mode floating"); assignment->dest.command = sstrdup("floating enable");
TAILQ_INSERT_TAIL(&assignments, assignment, assignments); TAILQ_INSERT_TAIL(&assignments, assignment, assignments);
break; break;
} else { } else {
@ -700,7 +700,7 @@ assign:
Assignment *floating = scalloc(sizeof(Assignment)); Assignment *floating = scalloc(sizeof(Assignment));
match_copy(&(floating->match), match); match_copy(&(floating->match), match);
floating->type = A_COMMAND; floating->type = A_COMMAND;
floating->dest.command = sstrdup("mode floating"); floating->dest.command = sstrdup("floating enable");
TAILQ_INSERT_TAIL(&assignments, floating, assignments); TAILQ_INSERT_TAIL(&assignments, floating, assignments);
} }
} }

View File

@ -162,4 +162,50 @@ ok(@{get_ws_content('targetws')} == 2, 'two containers on targetws');
exit_gracefully($process->pid); exit_gracefully($process->pid);
#####################################################################
# start a window and see that it gets assigned to a workspace which has content
# already, next to the existing node.
#####################################################################
($fh, $tmpfile) = tempfile();
say $fh "font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1";
say $fh "ipc-socket /tmp/nestedcons";
say $fh q|assign "special" → ~|;
close($fh);
diag("Starting i3");
$i3cmd = "exec " . abs_path("../i3") . " -V -d all --disable-signalhandler -c $tmpfile >/dev/null 2>/dev/null";
$process = Proc::Background->new($i3cmd);
sleep 1;
diag("pid = " . $process->pid);
$tmp = fresh_workspace;
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
my $workspaces = get_workspace_names;
ok(!("targetws" ~~ @{$workspaces}), 'targetws does not exist yet');
my $window = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
rect => [ 0, 0, 30, 30 ],
background_color => '#0000ff',
);
$window->_create;
set_wm_class($window->id, 'special', 'special');
$window->name('special window');
$window->map;
sleep 0.25;
my $content = get_ws($tmp);
ok(@{$content->{nodes}} == 0, 'no tiling cons');
ok(@{$content->{floating_nodes}} == 1, 'one floating con');
$window->destroy;
exit_gracefully($process->pid);
sleep 0.25;
done_testing; done_testing;