From 2ec26cd9b5a628b128fa6264ff43d27f6b4ca1ea Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 20 Feb 2015 17:36:10 +0100 Subject: [PATCH] cssnode: Move style context function to only user --- gtk/gtkcsswidgetnode.c | 26 +++++++++++++++++++++++++- gtk/gtkstylecontext.c | 30 ------------------------------ gtk/gtkstylecontextprivate.h | 2 -- 3 files changed, 25 insertions(+), 33 deletions(-) diff --git a/gtk/gtkcsswidgetnode.c b/gtk/gtkcsswidgetnode.c index 1bc21244df..42348f99f7 100644 --- a/gtk/gtkcsswidgetnode.c +++ b/gtk/gtkcsswidgetnode.c @@ -84,6 +84,30 @@ gtk_css_widget_node_dequeue_validate (GtkCssNode *node) G_GNUC_END_IGNORE_DEPRECATIONS } +static gboolean +gtk_css_widget_node_should_create_transitions (GtkCssWidgetNode *widget_node, + GtkCssStyle *previous_style) +{ + GtkWidget *widget; + gboolean animate; + + widget = widget_node->widget; + if (widget == NULL) + return FALSE; + + if (!gtk_widget_get_mapped (widget)) + return FALSE; + + if (previous_style == gtk_css_static_style_get_default ()) + return FALSE; + + g_object_get (gtk_widget_get_settings (widget), + "gtk-enable-animations", &animate, + NULL); + + return animate; +} + static gboolean gtk_css_static_style_needs_revalidate (GtkCssStaticStyle *style, GtkCssChange change) @@ -149,7 +173,7 @@ gtk_css_widget_node_validate (GtkCssNode *node, parent ? gtk_css_node_get_style (parent) : NULL, timestamp, gtk_css_node_get_style_provider (node), - gtk_style_context_should_create_transitions (context, style) ? style : NULL); + gtk_css_widget_node_should_create_transitions (widget_node, style) ? style : NULL); g_object_unref (new_static_style); } diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c index 33e56ee58b..d1ae36971f 100644 --- a/gtk/gtkstylecontext.c +++ b/gtk/gtkstylecontext.c @@ -2424,36 +2424,6 @@ gtk_style_context_do_invalidate (GtkStyleContext *context, priv->invalidating_context = NULL; } -gboolean -gtk_style_context_should_create_transitions (GtkStyleContext *context, - GtkCssStyle *previous_style) -{ - GtkStyleContextPrivate *priv; - GtkWidget *widget; - gboolean animate; - - priv = context->priv; - - if (GTK_IS_CSS_WIDGET_NODE (priv->cssnode)) - return FALSE; - - widget = gtk_css_widget_node_get_widget (GTK_CSS_WIDGET_NODE (priv->cssnode)); - if (widget == NULL) - return FALSE; - - if (!gtk_widget_get_mapped (widget)) - return FALSE; - - if (previous_style == gtk_css_static_style_get_default ()) - return FALSE; - - g_object_get (gtk_widget_get_settings (widget), - "gtk-enable-animations", &animate, - NULL); - - return animate; -} - void gtk_style_context_validate (GtkStyleContext *context, const GtkBitmask *changes) diff --git a/gtk/gtkstylecontextprivate.h b/gtk/gtkstylecontextprivate.h index f2791a741a..331eb60f69 100644 --- a/gtk/gtkstylecontextprivate.h +++ b/gtk/gtkstylecontextprivate.h @@ -45,8 +45,6 @@ GtkCssValue * _gtk_style_context_peek_property (GtkStyleContext *c const GValue * _gtk_style_context_peek_style_property (GtkStyleContext *context, GType widget_type, GParamSpec *pspec); -gboolean gtk_style_context_should_create_transitions (GtkStyleContext *context, - GtkCssStyle *previous_style); void gtk_style_context_validate (GtkStyleContext *context, const GtkBitmask*changes); gboolean _gtk_style_context_check_region_name (const gchar *str);