stylecontext: Add public API to stop animations

... and use it.

Of course, there still are no animations, so we don't turn anything off
yet.
This commit is contained in:
Benjamin Otte 2012-04-10 15:50:00 +02:00
parent a240808824
commit fe89e710ea
3 changed files with 19 additions and 1 deletions

View File

@ -765,7 +765,7 @@ gtk_style_context_finalize (GObject *object)
style_context = GTK_STYLE_CONTEXT (object);
priv = style_context->priv;
gtk_style_context_stop_animating (style_context);
_gtk_style_context_stop_animations (style_context);
/* children hold a reference to us */
g_assert (priv->children == NULL);
@ -1023,6 +1023,8 @@ _gtk_style_context_set_widget (GtkStyleContext *context,
context->priv->widget = widget;
_gtk_style_context_stop_animations (context);
_gtk_style_context_queue_invalidate (context, GTK_CSS_CHANGE_ANY_SELF);
}
@ -2915,6 +2917,17 @@ gtk_style_context_do_invalidate (GtkStyleContext *context)
priv->invalidating_context = FALSE;
}
void
_gtk_style_context_stop_animations (GtkStyleContext *context)
{
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
if (!gtk_style_context_is_animating (context))
return;
gtk_style_context_stop_animating (context);
}
void
_gtk_style_context_validate (GtkStyleContext *context,
gint64 timestamp,

View File

@ -52,6 +52,8 @@ void _gtk_style_context_get_cursor_color (GtkStyleContext *c
GdkRGBA *primary_color,
GdkRGBA *secondary_color);
void _gtk_style_context_stop_animations (GtkStyleContext *context);
G_END_DECLS
#endif /* __GTK_STYLE_CONTEXT_PRIVATE_H__ */

View File

@ -4126,6 +4126,9 @@ gtk_widget_real_hide (GtkWidget *widget)
if (gtk_widget_get_mapped (widget))
gtk_widget_unmap (widget);
if (widget->priv->context)
_gtk_style_context_stop_animations (widget->priv->context);
}
}