summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2018-01-17 15:42:01 +0100
committerTimm Bäder <mail@baedert.org>2018-01-17 21:57:20 +0100
commite7b3909fd13e441d29fca0ff866abdd31bb87b2c (patch)
tree1bed7d79ee15949ced284d64a239cc6ea0337bfa
parent27c76db9569372cfb8f8797b67e1ac0d2f4cdfc1 (diff)
downloadgtk+-e7b3909fd13e441d29fca0ff866abdd31bb87b2c.tar.gz
sizerequest: Fix for_size adjustment
We need to pull the proper size from the size request cache and adjust it accordingly.
-rw-r--r--gtk/gtksizerequest.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/gtk/gtksizerequest.c b/gtk/gtksizerequest.c
index 3838e5cf9f..2b8ec8fcbd 100644
--- a/gtk/gtksizerequest.c
+++ b/gtk/gtksizerequest.c
@@ -154,7 +154,6 @@ gtk_widget_query_size_for_orientation (GtkWidget *widget,
if (!found_in_cache)
{
int adjusted_min, adjusted_natural;
- int adjusted_for_size = for_size;
int reported_min_size = 0;
int reported_nat_size = 0;
@@ -188,29 +187,26 @@ gtk_widget_query_size_for_orientation (GtkWidget *widget,
}
else
{
- int dummy = 0;
+ int adjusted_for_size;
int minimum_for_size = 0;
int natural_for_size = 0;
+ int dummy = 0;
- /* Pull the base natural size from the cache as it's needed to adjust
+ /* Pull the minimum for_size from the cache as it's needed to adjust
* the proposed 'for_size' */
- widget_class->measure (widget, OPPOSITE_ORIENTATION (orientation), -1,
- &minimum_for_size, &natural_for_size, &dummy, &dummy);
-
- gtk_widget_adjust_size_allocation (widget,
- OPPOSITE_ORIENTATION (orientation),
- &minimum_for_size,
- &natural_for_size,
- &dummy,
- &adjusted_for_size);
-
- /* adjusted_for_size now without widget margins */
- adjusted_for_size -= css_extra_for_size;
+ gtk_widget_measure (widget, OPPOSITE_ORIENTATION (orientation), -1,
+ &minimum_for_size, &natural_for_size, NULL, NULL);
/* TODO: Warn if the given for_size is too small? */
+ if (for_size < MAX (minimum_for_size, css_min_for_size))
+ for_size = MAX (minimum_for_size, css_min_for_size);
+
+ adjusted_for_size = for_size;
+ gtk_widget_adjust_size_allocation (widget, OPPOSITE_ORIENTATION (orientation),
+ &for_size, &natural_for_size,
+ &dummy, &adjusted_for_size);
- if (adjusted_for_size < MAX (minimum_for_size, css_min_for_size))
- adjusted_for_size = MAX (minimum_for_size, css_min_for_size);
+ adjusted_for_size -= css_extra_for_size;
push_recursion_check (widget, orientation);
widget_class->measure (widget,