[gtk+/wip/cssvalue: 150/165] stylecontext: Add public API to stop animations



commit 313a9fab5be27f6bd4ffb12d30680cd9e0c7d392
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 2e6dd45..1be5da8 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]