diff options
author | Timm Bäder <mail@baedert.org> | 2017-05-06 14:05:30 +0200 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2017-07-19 21:27:11 -0400 |
commit | 6d34a19cdd1dd108b6f3a112ecc7cb723cd3b16c (patch) | |
tree | 547a8ea0440038894ddd5652c37cf5d2aa425418 /gtk/gtksizerequest.c | |
parent | 78bb0ed2cb3ac11a8c00e5fc4723aef68f97ea66 (diff) | |
download | gtk+-6d34a19cdd1dd108b6f3a112ecc7cb723cd3b16c.tar.gz |
sizerequest: Make size groups "work"
We have to query the css margin/border/padding values for all widgets
in the size group.
Diffstat (limited to 'gtk/gtksizerequest.c')
-rw-r--r-- | gtk/gtksizerequest.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/gtk/gtksizerequest.c b/gtk/gtksizerequest.c index 9648f22c77..5b54ea3861 100644 --- a/gtk/gtksizerequest.c +++ b/gtk/gtksizerequest.c @@ -479,17 +479,30 @@ gtk_widget_measure (GtkWidget *widget, GtkWidget *tmp_widget = key; gint min_dimension, nat_dimension; + style = gtk_css_node_get_style (gtk_widget_get_css_node (tmp_widget)); + get_box_margin (style, &margin); + get_box_border (style, &border); + get_box_padding (style, &padding); + + if (orientation == GTK_ORIENTATION_HORIZONTAL) + { + css_extra_size = margin.left + margin.right + border.left + border.right + padding.left + padding.right; + css_min_size = get_number (style, GTK_CSS_PROPERTY_MIN_WIDTH); + } + else + { + css_extra_size = margin.top + margin.bottom + border.top + border.bottom + padding.top + padding.bottom; + css_min_size = get_number (style, GTK_CSS_PROPERTY_MIN_HEIGHT); + } + gtk_widget_query_size_for_orientation (tmp_widget, orientation, for_size, &min_dimension, &nat_dimension, NULL, NULL); - min_result = MAX (min_result, min_dimension); - nat_result = MAX (nat_result, nat_dimension); + min_result = MAX (min_result, MAX (min_dimension, css_min_size) + css_extra_size); + nat_result = MAX (nat_result, MAX (nat_dimension, css_min_size) + css_extra_size); } g_hash_table_destroy (widgets); - /* TODO: Since we query the content sizes for all the widget in the size group, we need to also - * query all the widget sizes for all of them and MAX that? */ - /* Baselines make no sense with sizegroups really */ if (minimum_baseline) *minimum_baseline = -1; @@ -498,10 +511,10 @@ gtk_widget_measure (GtkWidget *widget, *natural_baseline = -1; if (minimum) - *minimum = min_result + css_extra_size; + *minimum = min_result; if (natural) - *natural = nat_result + css_extra_size; + *natural = nat_result; } /** |