[gtk+/wip/cssvalue: 140/165] stylecontext: Pass time to style_context_validate()



commit 0680b7d036b207e3a0990e084dcc25c6d915de62
Author: Benjamin Otte <otte redhat com>
Date:   Sat Apr 7 22:44:00 2012 +0200

    stylecontext: Pass time to style_context_validate()
    
    This way, we can ensure that every style context uses the same timestamp
    for whatever they do.

 gtk/gtkcontainer.c           |   10 ++++++++--
 gtk/gtkstylecontext.c        |    3 ++-
 gtk/gtkstylecontextprivate.h |    1 +
 3 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 425eea8..e3fabe8 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -1643,6 +1643,7 @@ static gboolean
 gtk_container_idle_sizer (gpointer data)
 {
   GSList *slist;
+  gint64 current_time;
 
   /* we may be invoked with a container_resize_queue of NULL, because
    * queue_resize could have been adding an extra idle function while
@@ -1657,9 +1658,12 @@ gtk_container_idle_sizer (gpointer data)
    * because size_allocate functions often change styles and so could
    * cause infinite loops in this function.
    */
+  current_time = g_get_monotonic_time ();
   for (slist = container_resize_queue; slist; slist = slist->next)
     {
-      _gtk_style_context_validate (gtk_widget_get_style_context (slist->data), 0);
+      _gtk_style_context_validate (gtk_widget_get_style_context (slist->data),
+                                   current_time,
+                                   0);
     }
 
   while (container_resize_queue)
@@ -1728,7 +1732,9 @@ _gtk_container_queue_resize_internal (GtkContainer *container,
               break;
 
             case GTK_RESIZE_IMMEDIATE:
-              _gtk_style_context_validate (gtk_widget_get_style_context (GTK_WIDGET (resize_container)), 0);
+              _gtk_style_context_validate (gtk_widget_get_style_context (GTK_WIDGET (resize_container)),
+                                           g_get_monotonic_time (),
+                                           0);
               gtk_container_check_resize (resize_container);
               break;
 
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index b50f9d0..2d8023c 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -2787,6 +2787,7 @@ gtk_style_context_do_invalidate (GtkStyleContext *context)
 
 void
 _gtk_style_context_validate (GtkStyleContext *context,
+                             gint64           timestamp,
                              GtkCssChange     change)
 {
   GtkStyleContextPrivate *priv;
@@ -2860,7 +2861,7 @@ _gtk_style_context_validate (GtkStyleContext *context,
   change = _gtk_css_change_for_child (change);
   for (list = priv->children; list; list = list->next)
     {
-      _gtk_style_context_validate (list->data, change);
+      _gtk_style_context_validate (list->data, timestamp, change);
     }
 }
 
diff --git a/gtk/gtkstylecontextprivate.h b/gtk/gtkstylecontextprivate.h
index 08f21b3..c6ab2cc 100644
--- a/gtk/gtkstylecontextprivate.h
+++ b/gtk/gtkstylecontextprivate.h
@@ -36,6 +36,7 @@ const GValue * _gtk_style_context_peek_style_property        (GtkStyleContext *c
                                                               GtkStateFlags    state,
                                                               GParamSpec      *pspec);
 void           _gtk_style_context_validate                   (GtkStyleContext *context,
+                                                              gint64           timestamp,
                                                               GtkCssChange     change);
 void           _gtk_style_context_queue_invalidate           (GtkStyleContext *context,
                                                               GtkCssChange     change);



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