stylecontext: Pass time to style_context_validate()

This way, we can ensure that every style context uses the same timestamp
for whatever they do.
This commit is contained in:
Benjamin Otte 2012-04-07 22:44:00 +02:00
parent aaedc7b67f
commit 29fbfcb8f5
3 changed files with 11 additions and 3 deletions

View File

@ -1643,6 +1643,7 @@ static gboolean
gtk_container_idle_sizer (gpointer data)
{
GSList *slist;
gint64 current_time;
/* we may be invoked with a container_resize_queue of NULL, because
* queue_resize could have been adding an extra idle function while
@ -1657,9 +1658,12 @@ gtk_container_idle_sizer (gpointer data)
* because size_allocate functions often change styles and so could
* cause infinite loops in this function.
*/
current_time = g_get_monotonic_time ();
for (slist = container_resize_queue; slist; slist = slist->next)
{
_gtk_style_context_validate (gtk_widget_get_style_context (slist->data), 0);
_gtk_style_context_validate (gtk_widget_get_style_context (slist->data),
current_time,
0);
}
while (container_resize_queue)
@ -1728,7 +1732,9 @@ _gtk_container_queue_resize_internal (GtkContainer *container,
break;
case GTK_RESIZE_IMMEDIATE:
_gtk_style_context_validate (gtk_widget_get_style_context (GTK_WIDGET (resize_container)), 0);
_gtk_style_context_validate (gtk_widget_get_style_context (GTK_WIDGET (resize_container)),
g_get_monotonic_time (),
0);
gtk_container_check_resize (resize_container);
break;

View File

@ -2787,6 +2787,7 @@ gtk_style_context_do_invalidate (GtkStyleContext *context)
void
_gtk_style_context_validate (GtkStyleContext *context,
gint64 timestamp,
GtkCssChange change)
{
GtkStyleContextPrivate *priv;
@ -2860,7 +2861,7 @@ _gtk_style_context_validate (GtkStyleContext *context,
change = _gtk_css_change_for_child (change);
for (list = priv->children; list; list = list->next)
{
_gtk_style_context_validate (list->data, change);
_gtk_style_context_validate (list->data, timestamp, change);
}
}

View File

@ -36,6 +36,7 @@ const GValue * _gtk_style_context_peek_style_property (GtkStyleContext *c
GtkStateFlags state,
GParamSpec *pspec);
void _gtk_style_context_validate (GtkStyleContext *context,
gint64 timestamp,
GtkCssChange change);
void _gtk_style_context_queue_invalidate (GtkStyleContext *context,
GtkCssChange change);