From: Michael Stapelberg Date: Mon, 28 Feb 2011 22:59:56 +0000 (+0100) Subject: Bugfix: Correctly fix the percent values for resizing when making a floating con... X-Git-Tag: tree-pr2~24 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=33c2b4e58232f7384d996c8aaf6a512605525c3f;p=i3%2Fi3 Bugfix: Correctly fix the percent values for resizing when making a floating con tiling (Thanks mseed) (+testcase) --- diff --git a/src/floating.c b/src/floating.c index fac78a0f..558f7f9a 100644 --- a/src/floating.c +++ b/src/floating.c @@ -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 index 00000000..b3ff9a47 --- /dev/null +++ b/testcases/t/51-regress-float-size.t @@ -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;