mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 14:31:10 +00:00
boxlayout: Be more careful with what to consider natural size
Don't just use the natural size as the max size, the natural size is the ideal size, not necessarily the maximum size. Also check the nat size for opposite min size.
This commit is contained in:
parent
c4e5242be0
commit
4ffa60be50
@ -327,6 +327,8 @@ gtk_box_layout_compute_opposite_size_for_size (GtkBoxLayout *self,
|
||||
child != NULL;
|
||||
child = _gtk_widget_get_next_sibling (child))
|
||||
{
|
||||
int min_opposite, nat_for_min;
|
||||
|
||||
if (!gtk_widget_should_layout (child))
|
||||
continue;
|
||||
|
||||
@ -335,6 +337,22 @@ gtk_box_layout_compute_opposite_size_for_size (GtkBoxLayout *self,
|
||||
-1,
|
||||
&sizes[i].minimum_size, &sizes[i].natural_size,
|
||||
NULL, NULL);
|
||||
/* Don't just use the natural size as the max size,
|
||||
* the natural size is the ideal size, not necessarily
|
||||
* the maximum size.
|
||||
* Also check the nat size for opposite min size.
|
||||
*/
|
||||
gtk_widget_measure (child,
|
||||
OPPOSITE_ORIENTATION (self->orientation),
|
||||
-1,
|
||||
&min_opposite, NULL,
|
||||
NULL, NULL);
|
||||
gtk_widget_measure (child,
|
||||
self->orientation,
|
||||
min_opposite,
|
||||
NULL, &nat_for_min,
|
||||
NULL, NULL);
|
||||
sizes[i].natural_size = MAX (sizes[i].natural_size, nat_for_min);
|
||||
|
||||
children_minimum_size += sizes[i].minimum_size;
|
||||
i += 1;
|
||||
|
Loading…
Reference in New Issue
Block a user