Respect minimum size hints for floating windows. (#2508)
This commit introduces proper support for the minimum size on floating windows by ensuring that it is respected during mapping, later changes as well as resizes. Furthermore, this commit fixes minor issues with how the hints are handled during calculations. fixes #2436
This commit is contained in:
committed by
Michael Stapelberg
parent
f25c3d5e77
commit
a301396997
@ -298,11 +298,11 @@ sub get_floating_rect {
|
||||
# focus is on the right window, so we resize the left one using criteria
|
||||
my $leftold = get_floating_rect($left->id);
|
||||
my $rightold = get_floating_rect($right->id);
|
||||
cmd '[id="' . $left->id . '"] resize shrink height 10px or 10ppt';
|
||||
cmd '[id="' . $left->id . '"] resize grow height 10px or 10ppt';
|
||||
|
||||
my $leftnew = get_floating_rect($left->id);
|
||||
my $rightnew = get_floating_rect($right->id);
|
||||
is($rightnew->{height}, $rightold->{height}, 'height of right container unchanged');
|
||||
is($leftnew->{height}, $leftold->{height} - 10, 'height of left container changed');
|
||||
is($leftnew->{height}, $leftold->{height} + 10, 'height of left container changed');
|
||||
|
||||
done_testing;
|
||||
|
@ -62,10 +62,10 @@ sub open_with_fixed_size {
|
||||
|
||||
my $flags = $XCB_ICCCM_SIZE_HINT_P_MIN_SIZE | $XCB_ICCCM_SIZE_HINT_P_MAX_SIZE;
|
||||
|
||||
my $min_width = 55;
|
||||
my $max_width = 55;
|
||||
my $min_height = 77;
|
||||
my $max_height = 77;
|
||||
my $min_width = 150;
|
||||
my $max_width = 150;
|
||||
my $min_height = 100;
|
||||
my $max_height = 100;
|
||||
|
||||
my $pad = 0x00;
|
||||
|
||||
@ -82,7 +82,7 @@ sub open_with_fixed_size {
|
||||
$atomtype->id,
|
||||
32,
|
||||
12,
|
||||
pack('C5N8', $flags, $pad, $pad, $pad, $pad, 0, 0, 0, $min_width, $min_height, $max_width, $max_height),
|
||||
pack('C5N7', $flags, $pad, $pad, $pad, $pad, 0, 0, 0, $min_width, $min_height, $max_width, $max_height),
|
||||
);
|
||||
},
|
||||
);
|
||||
@ -114,6 +114,8 @@ $window->unmap;
|
||||
|
||||
$window = open_with_fixed_size;
|
||||
is(get_ws($ws)->{floating_nodes}[0]->{nodes}[0]->{window}, $window->id, 'Fixed size window opened floating');
|
||||
is(get_ws($ws)->{floating_nodes}[0]->{nodes}[0]->{window_rect}->{width}, 150, 'Fixed size window opened with minimum width');
|
||||
is(get_ws($ws)->{floating_nodes}[0]->{nodes}[0]->{window_rect}->{height}, 100, 'Fixed size window opened with minimum height');
|
||||
$window->unmap;
|
||||
|
||||
done_testing;
|
||||
|
Reference in New Issue
Block a user