]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Correctly fix the percent values for resizing when making a floating con...
authorMichael Stapelberg <michael@stapelberg.de>
Mon, 28 Feb 2011 22:59:56 +0000 (23:59 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Mon, 28 Feb 2011 22:59:56 +0000 (23:59 +0100)
src/floating.c
testcases/t/51-regress-float-size.t [new file with mode: 0644]

index fac78a0f512bf8e7a854114752dc15c9f3211c80..558f7f9aa8dae10cf322efbd447ec45d4040f4e8 100644 (file)
@@ -164,11 +164,8 @@ void floating_disable(Con *con, bool automatic) {
         con->parent = focused;
     else con->parent = focused->parent;
 
-    /* XXX: We adjust the percentage value to start with a fair value. Floating
-     * cons always have 1.0 as percent which doesn’t work so well when
-     * re-inserting (the formerly floating con would get 50% of the target
-     * con). */
-    con->percent = (1.0 / con_num_children(con->parent));
+    /* con_fix_percent will adjust the percent value */
+    con->percent = 0.0;
 
     TAILQ_INSERT_TAIL(&(con->parent->nodes_head), con, nodes);
     TAILQ_INSERT_TAIL(&(con->parent->focus_head), con, focused);
diff --git a/testcases/t/51-regress-float-size.t b/testcases/t/51-regress-float-size.t
new file mode 100644 (file)
index 0000000..b3ff9a4
--- /dev/null
@@ -0,0 +1,20 @@
+#!perl
+# vim:ts=4:sw=4:expandtab
+#
+# Regression test for setting a window to floating, tiling and opening a new window
+#
+use Time::HiRes qw(sleep);
+use i3test;
+
+my $tmp = get_unused_workspace;
+cmd "workspace $tmp";
+
+
+cmd 'open';
+cmd 'mode toggle';
+cmd 'mode toggle';
+cmd 'open';
+
+does_i3_live;
+
+done_testing;