[gtk+/wip/cssnode3: 66/102] cssnode: Return NULL as frame clock when animations are disabled



commit 6db90253da8776a59f9f2e297a428ee5d8b0e5c9
Author: Benjamin Otte <otte redhat com>
Date:   Sat Feb 21 00:16:58 2015 +0100

    cssnode: Return NULL as frame clock when animations are disabled
    
    This is a crude hack, but it works.
    
    FIXME: Hook it up to the GtkSettings so that we properly update when the
    setting changes.

 gtk/gtkcsswidgetnode.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkcsswidgetnode.c b/gtk/gtkcsswidgetnode.c
index 42348f9..2860d08 100644
--- a/gtk/gtkcsswidgetnode.c
+++ b/gtk/gtkcsswidgetnode.c
@@ -89,7 +89,6 @@ gtk_css_widget_node_should_create_transitions (GtkCssWidgetNode *widget_node,
                                                GtkCssStyle      *previous_style)
 {
   GtkWidget *widget;
-  gboolean animate;
 
   widget = widget_node->widget;
   if (widget == NULL)
@@ -101,11 +100,7 @@ gtk_css_widget_node_should_create_transitions (GtkCssWidgetNode *widget_node,
   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;
+  return TRUE;
 }
 
 static gboolean
@@ -306,10 +301,17 @@ static GdkFrameClock *
 gtk_css_widget_node_get_frame_clock (GtkCssNode *node)
 {
   GtkCssWidgetNode *widget_node = GTK_CSS_WIDGET_NODE (node);
+  gboolean animate;
 
   if (widget_node->widget == NULL)
     return NULL;
 
+  g_object_get (gtk_widget_get_settings (widget_node->widget),
+                "gtk-enable-animations", &animate,
+                NULL);
+  if (animate == FALSE)
+    return NULL;
+
   return gtk_widget_get_frame_clock (widget_node->widget);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]