Bugfix: Don’t redistribute resize percentage values when closing floating (!) windows (Thanks Merovius) (+testcase)

This commit is contained in:
Michael Stapelberg 2010-12-30 02:39:14 +01:00
parent 307c59bde6
commit f65e4f5b16
2 changed files with 43 additions and 1 deletions

View File

@ -180,7 +180,11 @@ void tree_close(Con *con, bool kill_window, bool dont_kill_parent) {
x_con_kill(con); x_con_kill(con);
con_detach(con); con_detach(con);
if (con->type != CT_FLOATING_CON) {
/* If the container is *not* floating, we might need to re-distribute
* percentage values for the resized containers. */
con_fix_percent(parent, WINDOW_REMOVE); con_fix_percent(parent, WINDOW_REMOVE);
}
if (con_is_floating(con)) { if (con_is_floating(con)) {
DLOG("Container was floating, killing floating container\n"); DLOG("Container was floating, killing floating container\n");

View File

@ -0,0 +1,38 @@
#!perl
# vim:ts=4:sw=4:expandtab
#
# Regression: when resizing two containers on a workspace, opening a floating
# client, then closing it again, i3 will re-distribute the space on the
# workspace as if a tiling container was closed, leading to the containers
# taking much more space than they possibly could.
#
use i3test tests => 1;
use X11::XCB qw(:all);
use Time::HiRes qw(sleep);
use List::Util qw(sum);
my $tmp = get_unused_workspace();
cmd "workspace $tmp";
cmd 'exec /usr/bin/urxvt';
sleep 0.5;
cmd 'exec /usr/bin/urxvt';
sleep 0.5;
my ($nodes, $focus) = get_ws_content($tmp);
my $old_sum = sum map { $_->{rect}->{width} } @{$nodes};
#cmd 'open';
cmd 'resize grow left 10 px or 25 ppt';
cmd 'split v';
#cmd 'open';
cmd 'exec /usr/bin/urxvt';
sleep 0.5;
cmd 'mode toggle';
sleep 0.5;
cmd 'kill';
sleep 0.5;
($nodes, $focus) = get_ws_content($tmp);
my $new_sum = sum map { $_->{rect}->{width} } @{$nodes};
is($old_sum, $new_sum, 'combined container width is still equal');