]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Fix floating resize for floating split containers (+test)
authorMichael Stapelberg <michael@stapelberg.de>
Sun, 18 Dec 2011 15:18:20 +0000 (15:18 +0000)
committerMichael Stapelberg <michael@stapelberg.de>
Sun, 18 Dec 2011 15:18:20 +0000 (15:18 +0000)
Fixes: #588
src/cmdparse.y
testcases/t/184-regress-float-split-resize.t [new file with mode: 0644]

index d01ca23232807ddf6af0739eb779826c39533c31..652f6adce3dd5010889d0ab3237e392b84cc0a62 100644 (file)
@@ -981,18 +981,19 @@ resize:
             ppt *= -1;
         }
 
-        if (con_is_floating(focused)) {
+        Con *floating_con;
+        if ((floating_con = con_inside_floating(focused))) {
             printf("floating resize\n");
             if (direction == TOK_UP) {
-                focused->parent->rect.y -= px;
-                focused->parent->rect.height += px;
+                floating_con->rect.y -= px;
+                floating_con->rect.height += px;
             } else if (direction == TOK_DOWN) {
-                focused->parent->rect.height += px;
+                floating_con->rect.height += px;
             } else if (direction == TOK_LEFT) {
-                focused->parent->rect.x -= px;
-                focused->parent->rect.width += px;
+                floating_con->rect.x -= px;
+                floating_con->rect.width += px;
             } else {
-                focused->parent->rect.width += px;
+                floating_con->rect.width += px;
             }
         } else {
             LOG("tiling resize\n");
diff --git a/testcases/t/184-regress-float-split-resize.t b/testcases/t/184-regress-float-split-resize.t
new file mode 100644 (file)
index 0000000..1a21f2b
--- /dev/null
@@ -0,0 +1,23 @@
+#!perl
+# vim:ts=4:sw=4:expandtab
+#
+# Regression: resizing a floating split container leads to a crash.
+# (Ticket #588, present until 4412ccbe5a4fad8a4cd594e6f10f937515a4d37c)
+#
+use i3test;
+
+my $tmp = fresh_workspace;
+
+my $first = open_window;
+cmd 'split v';
+my $second = open_window;
+
+cmd 'focus parent';
+cmd 'floating toggle';
+cmd 'layout stacking';
+
+cmd 'resize grow up 10 px or 10 ppt';
+
+does_i3_live;
+
+done_testing;