diff options
author | Benjamin Otte <otte@redhat.com> | 2020-09-09 15:56:10 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2020-09-09 17:38:37 +0200 |
commit | cc58956dbbe7ba6bb1c1b338678e7708e9b90df8 (patch) | |
tree | 40e929d0beda4a499aec1e8407ad137969db8c45 | |
parent | 0ad10ccf3993c66a05a3dc623e8bb86b0390a047 (diff) | |
download | gtk+-cc58956dbbe7ba6bb1c1b338678e7708e9b90df8.tar.gz |
revealer: Use floor(), not ceil()
We use ceil() in measure(), so using it again will increase the
child's size whenever there is even a tiny rounding error.
This should also not make the size too small, because:
min = ceil(child_min * scale)
min / scale >= child_min
floor (min / scale) >= floor (child_min) = child_min
The last equality is because child_min is an integer.
Fixes #3137
-rw-r--r-- | gtk/gtkrevealer.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gtk/gtkrevealer.c b/gtk/gtkrevealer.c index b921ef6e44..c6ac90c9ce 100644 --- a/gtk/gtkrevealer.c +++ b/gtk/gtkrevealer.c @@ -491,13 +491,13 @@ gtk_revealer_size_allocate (GtkWidget *widget, if (hscale < 1.0) { g_assert (vscale == 1.0); - child_width = MIN (100*width, ceil (width / hscale)); + child_width = MIN (100 * width, floor (width / hscale)); child_height = height; } else if (vscale < 1.0) { child_width = width; - child_height = MIN (100*height, ceil (height / vscale)); + child_height = MIN (100 * height, floor (height / vscale)); } else { |