Commit c8adc241 authored by Alexander Mikhaylenko's avatar Alexander Mikhaylenko

header-bar: Respect CSS min-width and min-height

Fixes Librem5/libhandy#194
parent 1faaea01
Pipeline #55458 passed with stages
in 14 minutes and 33 seconds
......@@ -974,13 +974,20 @@ hdy_header_bar_measure (GtkWidget *widget,
GtkStyleContext *style_context;
GtkStateFlags state_flags;
GtkBorder border, margin, padding;
gint css_width, css_height;
gtk_style_context_get (gtk_widget_get_style_context (widget),
gtk_widget_get_state_flags (widget),
"min-width", &css_width,
"min-height", &css_height,
NULL);
if (for_size < 0)
hdy_header_bar_get_size (widget, orientation, minimum, natural);
else if (orientation == GTK_ORIENTATION_HORIZONTAL)
hdy_header_bar_compute_size_for_orientation (widget, for_size, minimum, natural);
hdy_header_bar_compute_size_for_orientation (widget, MAX (for_size, css_height), minimum, natural);
else
hdy_header_bar_compute_size_for_opposing_orientation (widget, for_size, minimum, natural);
hdy_header_bar_compute_size_for_opposing_orientation (widget, MAX (for_size, css_width), minimum, natural);
/* Manually apply the border, the padding and the margin as we can't use the
* private GtkGagdet.
......@@ -995,11 +1002,17 @@ hdy_header_bar_measure (GtkWidget *widget,
border.bottom + margin.bottom + padding.bottom;
*natural += border.top + margin.top + padding.top +
border.bottom + margin.bottom + padding.bottom;
*minimum = MAX (*minimum, css_height);
*natural = MAX (*natural, css_height);
} else {
*minimum += border.left + margin.left + padding.left +
border.right + margin.right + padding.right;
*natural += border.left + margin.left + padding.left +
border.right + margin.right + padding.right;
*minimum = MAX (*minimum, css_width);
*natural = MAX (*natural, css_width);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment