mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-09 18:30:08 +00:00
widget: force adjustment method is one size is FILL
If halign=fill, force adjustment to height-for-width. If valign=fill, force adjustment to width-for-height. Otherwise look at request mode. This way we don't try to adapt the filled dimension and only adjust the one that is not set to fill.
This commit is contained in:
parent
7459d430eb
commit
50e0893497
@ -3832,7 +3832,9 @@ gtk_widget_adjust_size_allocation (GtkWidget *widget,
|
|||||||
/* Note that adjust_for_align removes any margins from the
|
/* Note that adjust_for_align removes any margins from the
|
||||||
* allocated sizes and possibly limits them to the natural sizes */
|
* allocated sizes and possibly limits them to the natural sizes */
|
||||||
|
|
||||||
if (gtk_widget_get_request_mode (widget) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
|
if (priv->halign == GTK_ALIGN_FILL ||
|
||||||
|
(priv->valign != GTK_ALIGN_FILL &&
|
||||||
|
gtk_widget_get_request_mode (widget) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH))
|
||||||
{
|
{
|
||||||
gtk_widget_measure (widget, GTK_ORIENTATION_HORIZONTAL,
|
gtk_widget_measure (widget, GTK_ORIENTATION_HORIZONTAL,
|
||||||
allocation->height + priv->margin.top + priv->margin.bottom,
|
allocation->height + priv->margin.top + priv->margin.bottom,
|
||||||
|
@ -5,15 +5,10 @@
|
|||||||
<property name="default-height">300</property>
|
<property name="default-height">300</property>
|
||||||
<property name="decorated">0</property>
|
<property name="decorated">0</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkLabel">
|
||||||
<property name="halign">center</property>
|
<property name="halign">center</property>
|
||||||
<child>
|
<property name="label">Hello World</property>
|
||||||
<object class="GtkLabel">
|
<property name="wrap">True</property>
|
||||||
<property name="halign">center</property>
|
|
||||||
<property name="label">Hello World</property>
|
|
||||||
<property name="wrap">True</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
Loading…
Reference in New Issue
Block a user