[gtk+] widget: Add _gtk_widget_invalidate_style_context()



commit d589566f40a5e56eb8edba3feb23bacd57844efe
Author: Benjamin Otte <otte redhat com>
Date:   Tue Mar 20 15:40:53 2012 +0100

    widget: Add _gtk_widget_invalidate_style_context()
    
    This is supposed to replace gtk_widget_reset_style().

 gtk/gtkwidget.c        |   22 ++++++++++++++++------
 gtk/gtkwidgetprivate.h |    7 ++++++-
 2 files changed, 22 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 127c4e3..32a2c3b 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -8104,10 +8104,7 @@ static void
 modifier_style_changed (GtkModifierStyle *style,
                         GtkWidget        *widget)
 {
-  GtkStyleContext *context;
-
-  context = gtk_widget_get_style_context (widget);
-  gtk_style_context_invalidate (context);
+  _gtk_widget_invalidate_style_context (widget, GTK_CSS_CHANGE_ANY);
 }
 
 static GtkModifierStyle *
@@ -14069,8 +14066,7 @@ gtk_widget_get_path (GtkWidget *widget)
           gtk_widget_path_append_for_widget (widget->priv->path, widget);
         }
 
-      if (widget->priv->context)
-        gtk_style_context_invalidate (widget->priv->context);
+      _gtk_widget_invalidate_style_context (widget, GTK_CSS_CHANGE_ANY);
     }
 
   return widget->priv->path;
@@ -14133,6 +14129,20 @@ gtk_widget_get_style_context (GtkWidget *widget)
   return widget->priv->context;
 }
 
+void
+_gtk_widget_invalidate_style_context (GtkWidget    *widget,
+                                      GtkCssChange  change)
+{
+  GtkWidgetPrivate *priv;
+
+  priv = widget->priv;
+
+  if (priv->context == NULL)
+    return;
+
+  _gtk_style_context_queue_invalidate (priv->context, change);
+}
+
 /**
  * gtk_widget_get_modifier_mask:
  * @widget: a #GtkWidget
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index 608cf7c..5cf44dd 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -25,6 +25,9 @@
 #ifndef __GTK_WIDGET_PRIVATE_H__
 #define __GTK_WIDGET_PRIVATE_H__
 
+#include "gtkcsstypesprivate.h"
+#include "gtkwidget.h"
+
 G_BEGIN_DECLS
 
 /* Cache as many ranges of height-for-width
@@ -173,7 +176,9 @@ void              _gtk_widget_set_captured_event_handler (GtkWidget
 gboolean          _gtk_widget_captured_event               (GtkWidget *widget,
                                                             GdkEvent  *event);
 
-void              _gtk_widget_style_context_invalidated    (GtkWidget *widget);
+void              _gtk_widget_invalidate_style_context     (GtkWidget    *widget,
+                                                            GtkCssChange  change);
+void              _gtk_widget_style_context_invalidated    (GtkWidget    *widget);
 
 G_END_DECLS
 



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