[gtk+] stylecontext: Add public API to stop animations
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] stylecontext: Add public API to stop animations
- Date: Tue, 17 Apr 2012 07:21:34 +0000 (UTC)
commit fe89e710eaecb4018284f77bc978a8a2d97b6337
Author: Benjamin Otte <otte redhat com>
Date: Tue Apr 10 15:50:00 2012 +0200
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.
gtk/gtkstylecontext.c | 15 ++++++++++++++-
gtk/gtkstylecontextprivate.h | 2 ++
gtk/gtkwidget.c | 3 +++
3 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 8375328..065107c 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -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);
}
@@ -2916,6 +2918,17 @@ gtk_style_context_do_invalidate (GtkStyleContext *context)
}
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,
GtkCssChange change)
diff --git a/gtk/gtkstylecontextprivate.h b/gtk/gtkstylecontextprivate.h
index c6ab2cc..a62b467 100644
--- a/gtk/gtkstylecontextprivate.h
+++ b/gtk/gtkstylecontextprivate.h
@@ -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__ */
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 3c709ca..5b2aa3f 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -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);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]