widget: Add a resize_needed flag

... and API to set and unset it.

It is set when gtk_widget_queue_resize() is called.
It is unset when gtk_widget_get_preferred_width/height() is called.

So far it is not used.
This commit is contained in:
Benjamin Otte 2015-09-28 02:19:25 +02:00
parent 3ff894c201
commit 6cc2615b63
3 changed files with 15 additions and 0 deletions

View File

@ -149,6 +149,8 @@ gtk_widget_query_size_for_orientation (GtkWidget *widget,
gint nat_baseline = -1;
gboolean found_in_cache;
gtk_widget_ensure_resize (widget);
if (gtk_widget_get_request_mode (widget) == GTK_SIZE_REQUEST_CONSTANT_SIZE)
for_size = -1;

View File

@ -16161,7 +16161,19 @@ gtk_widget_queue_resize_on_widget (GtkWidget *widget)
{
GtkWidgetPrivate *priv = widget->priv;
priv->resize_needed = TRUE;
priv->alloc_needed = TRUE;
}
void
gtk_widget_ensure_resize (GtkWidget *widget)
{
GtkWidgetPrivate *priv = widget->priv;
if (!priv->resize_needed)
return;
priv->resize_needed = FALSE;
_gtk_size_request_cache_clear (&priv->requests);
}

View File

@ -167,6 +167,7 @@ void _gtk_widget_set_shadowed (GtkWidget *widget,
gboolean shadowed);
gboolean _gtk_widget_get_alloc_needed (GtkWidget *widget);
void gtk_widget_queue_resize_on_widget (GtkWidget *widget);
void gtk_widget_ensure_resize (GtkWidget *widget);
void _gtk_widget_draw (GtkWidget *widget,
cairo_t *cr);
void _gtk_widget_scale_changed (GtkWidget *widget);