Fixed extended layout implementors to not call ->get_desired_size() directly
Getting the desired size of a GtkWidget must always be done with gtk_widget_get_desired_size() and never with gtk_extended_layout_get_desired_size() directly as the former passes through size group logic and updates the widget->requisition cache.
This commit is contained in:
@ -461,7 +461,7 @@ gtk_alignment_size_allocate (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GtkExtendedLayout *layout = GTK_EXTENDED_LAYOUT (bin->child);
|
GtkExtendedLayout *layout = GTK_EXTENDED_LAYOUT (bin->child);
|
||||||
|
|
||||||
gtk_extended_layout_get_desired_size (layout, NULL, &child_requisition);
|
gtk_widget_get_desired_size (GTK_WIDGET (layout), NULL, &child_requisition);
|
||||||
|
|
||||||
border_width = GTK_CONTAINER (alignment)->border_width;
|
border_width = GTK_CONTAINER (alignment)->border_width;
|
||||||
|
|
||||||
|
|||||||
19
gtk/gtkbin.c
19
gtk/gtkbin.c
@ -156,12 +156,11 @@ gtk_bin_extended_layout_get_desired_size (GtkExtendedLayout *layout,
|
|||||||
GtkRequisition *minimum_size,
|
GtkRequisition *minimum_size,
|
||||||
GtkRequisition *natural_size)
|
GtkRequisition *natural_size)
|
||||||
{
|
{
|
||||||
GtkBin *bin = GTK_BIN (layout);
|
GtkWidget *child;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_EXTENDED_LAYOUT (bin->child));
|
child = gtk_bin_get_child (GTK_BIN (layout));
|
||||||
|
|
||||||
gtk_extended_layout_get_desired_size (GTK_EXTENDED_LAYOUT (bin->child),
|
gtk_widget_get_desired_size (child, minimum_size, natural_size);
|
||||||
minimum_size, natural_size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -170,11 +169,11 @@ gtk_bin_extended_layout_get_width_for_height (GtkExtendedLayout *layout,
|
|||||||
gint *minimum_width,
|
gint *minimum_width,
|
||||||
gint *natural_width)
|
gint *natural_width)
|
||||||
{
|
{
|
||||||
GtkBin *bin = GTK_BIN (layout);
|
GtkWidget *child;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_EXTENDED_LAYOUT (bin->child));
|
child = gtk_bin_get_child (GTK_BIN (layout));
|
||||||
|
|
||||||
gtk_extended_layout_get_width_for_height (GTK_EXTENDED_LAYOUT (bin->child),
|
gtk_extended_layout_get_width_for_height (GTK_EXTENDED_LAYOUT (child),
|
||||||
height, minimum_width, natural_width);
|
height, minimum_width, natural_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,11 +183,11 @@ gtk_bin_extended_layout_get_height_for_width (GtkExtendedLayout *layout,
|
|||||||
gint *minimum_height,
|
gint *minimum_height,
|
||||||
gint *natural_height)
|
gint *natural_height)
|
||||||
{
|
{
|
||||||
GtkBin *bin = GTK_BIN (layout);
|
GtkWidget *child;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_EXTENDED_LAYOUT (bin->child));
|
child = gtk_bin_get_child (GTK_BIN (layout));
|
||||||
|
|
||||||
gtk_extended_layout_get_height_for_width (GTK_EXTENDED_LAYOUT (bin->child),
|
gtk_extended_layout_get_height_for_width (GTK_EXTENDED_LAYOUT (child),
|
||||||
width, minimum_height, natural_height);
|
width, minimum_height, natural_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3333,9 +3333,9 @@ gtk_label_get_width_for_height (GtkExtendedLayout *layout,
|
|||||||
{
|
{
|
||||||
GtkRequisition minimum_size, natural_size;
|
GtkRequisition minimum_size, natural_size;
|
||||||
|
|
||||||
gtk_extended_layout_get_desired_size (layout,
|
gtk_widget_get_desired_size (layout,
|
||||||
minimum_width ? &minimum_size : NULL,
|
minimum_width ? &minimum_size : NULL,
|
||||||
natural_width ? &natural_size : NULL);
|
natural_width ? &natural_size : NULL);
|
||||||
|
|
||||||
if (minimum_width)
|
if (minimum_width)
|
||||||
*minimum_width = minimum_size.width;
|
*minimum_width = minimum_size.width;
|
||||||
@ -3359,9 +3359,9 @@ gtk_label_get_height_for_width (GtkExtendedLayout *layout,
|
|||||||
{
|
{
|
||||||
GtkRequisition minimum_size, natural_size;
|
GtkRequisition minimum_size, natural_size;
|
||||||
|
|
||||||
gtk_extended_layout_get_desired_size (layout,
|
gtk_widget_get_desired_size (layout,
|
||||||
minimum_height ? &minimum_size : NULL,
|
minimum_height ? &minimum_size : NULL,
|
||||||
natural_height ? &natural_size : NULL);
|
natural_height ? &natural_size : NULL);
|
||||||
|
|
||||||
if (minimum_height)
|
if (minimum_height)
|
||||||
*minimum_height = minimum_size.height;
|
*minimum_height = minimum_size.height;
|
||||||
|
|||||||
@ -781,9 +781,9 @@ gtk_plug_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_extended_layout_get_desired_size (GTK_EXTENDED_LAYOUT (bin->child),
|
gtk_widget_get_desired_size (bin->child,
|
||||||
NULL, &natural_size);
|
NULL, &natural_size);
|
||||||
_gtk_plug_windowing_publish_natural_size (GTK_PLUG (widget), &natural_size);
|
_gtk_plug_windowing_publish_natural_size (GTK_PLUG (widget), &natural_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|||||||
@ -1022,9 +1022,9 @@ gtk_socket_extended_layout_get_desired_size (GtkExtendedLayout *layout,
|
|||||||
|
|
||||||
if (socket->plug_widget)
|
if (socket->plug_widget)
|
||||||
{
|
{
|
||||||
gtk_extended_layout_get_desired_size (GTK_EXTENDED_LAYOUT (socket->plug_widget),
|
gtk_widget_get_desired_size (socket->plug_widget,
|
||||||
minimal_size,
|
minimal_size,
|
||||||
desired_size);
|
desired_size);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user