]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Fix floating assignments, extend test for the assign command (Thanks Tucos)
authorMichael Stapelberg <michael@stapelberg.de>
Mon, 13 Jun 2011 15:42:59 +0000 (17:42 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Mon, 13 Jun 2011 15:42:59 +0000 (17:42 +0200)
src/cfgparse.y
testcases/t/66-assign.t

index 4b443b89d946098d80da248e2217e9709dc24355..2258268f82adf2f80e9a7ef3224255c89cd98db4 100644 (file)
@@ -692,7 +692,7 @@ assign:
             if (*workspace == '\0') {
                 /* This assignment was *only* for floating */
                 assignment->type = A_COMMAND;
-                assignment->dest.command = sstrdup("mode floating");
+                assignment->dest.command = sstrdup("floating enable");
                 TAILQ_INSERT_TAIL(&assignments, assignment, assignments);
                 break;
             } else {
@@ -700,7 +700,7 @@ assign:
                 Assignment *floating = scalloc(sizeof(Assignment));
                 match_copy(&(floating->match), match);
                 floating->type = A_COMMAND;
-                floating->dest.command = sstrdup("mode floating");
+                floating->dest.command = sstrdup("floating enable");
                 TAILQ_INSERT_TAIL(&assignments, floating, assignments);
             }
         }
index 56b905486033cdb0be0317e5457ce2ce36e63f7d..84d71930fce12ead1c58f034691adbc50a8c3625 100644 (file)
@@ -162,4 +162,50 @@ ok(@{get_ws_content('targetws')} == 2, 'two containers on targetws');
 
 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;