]> Pileus Git - ~andy/gtk/commitdiff
debug: Add GTK_DEBUG=no-css-cache
authorBenjamin Otte <otte@redhat.com>
Tue, 1 May 2012 23:59:15 +0000 (01:59 +0200)
committerBenjamin Otte <otte@redhat.com>
Wed, 2 May 2012 00:00:11 +0000 (02:00 +0200)
See inline comments for what it does. Its main use is figuring out if
something has been caused by GTK's caching of CSS properties or if it's
a different problem.

docs/reference/gtk/running.sgml
gtk/gtkdebug.h
gtk/gtkmain.c
gtk/gtkstylecontext.c

index fe91aead749ac747cd00f48ae8932ff0c0a137af..3e4966af0e8539ce907646999d48beb3dead4063 100644 (file)
@@ -186,6 +186,14 @@ additional environment variables.
       <term>builder</term>
       <listitem><para>GtkBuilder support</para></listitem>
     </varlistentry>
+    <varlistentry>
+      <term>size-request</term>
+      <listitem><para>Size requests</para></listitem>
+    </varlistentry>
+    <varlistentry>
+      <term>no-css-cache</term>
+      <listitem><para>Bypass caching for CSS style properties.</para></listitem>
+    </varlistentry>
 
   </variablelist>
   The special value <literal>all</literal> can be used to turn on all
index b1eb70a0208dbb2c1c18099fba1e464d8b2e06b3..1eed41a2b9b4f40d0d357439d209e04f2f7249df 100644 (file)
@@ -46,7 +46,8 @@ typedef enum {
   GTK_DEBUG_ICONTHEME       = 1 << 9,
   GTK_DEBUG_PRINTING        = 1 << 10,
   GTK_DEBUG_BUILDER         = 1 << 11,
-  GTK_DEBUG_SIZE_REQUEST    = 1 << 12
+  GTK_DEBUG_SIZE_REQUEST    = 1 << 12,
+  GTK_DEBUG_NO_CSS_CACHE    = 1 << 13
 } GtkDebugFlag;
 
 #ifdef G_ENABLE_DEBUG
index 65df934ccbadb6123d70afb48b25f900a5c0ec57..c9f91736b7d5e0e275ea3f81ee62234ae3bdfea4 100644 (file)
@@ -172,6 +172,7 @@ static const GDebugKey gtk_debug_keys[] = {
   {"printing", GTK_DEBUG_PRINTING},
   {"builder", GTK_DEBUG_BUILDER},
   {"size-request", GTK_DEBUG_SIZE_REQUEST},
+  {"no-css-cache", GTK_DEBUG_NO_CSS_CACHE}
 };
 #endif /* G_ENABLE_DEBUG */
 
index 5fd398eaa982853f5ef432db56f24b77379f2077..ece1b8db0afe7511642bc11cb0a71d90ee4f2a37 100644 (file)
@@ -28,6 +28,7 @@
 #include "gtkcssenginevalueprivate.h"
 #include "gtkcssnumbervalueprivate.h"
 #include "gtkcssrgbavalueprivate.h"
+#include "gtkdebug.h"
 #include "gtkstylepropertiesprivate.h"
 #include "gtktypebuiltins.h"
 #include "gtkthemingengineprivate.h"
@@ -3041,6 +3042,21 @@ _gtk_style_context_validate (GtkStyleContext *context,
   priv = context->priv;
 
   change |= priv->pending_changes;
+  
+  /* If you run your application with
+   *   GTK_DEBUG=no-css-cache
+   * every invalidation will purge the cache and completely query
+   * everything anew form the cache. This is slow (in particular
+   * when animating), but useful for figuring out bugs.
+   *
+   * We achieve that by pretending that everything that could have
+   * changed has and so we of course totally need to redo everything.
+   *
+   * Note that this also completely revalidates child widgets all
+   * the time.
+   */
+  if (G_UNLIKELY (gtk_get_debug_flags () & GTK_DEBUG_NO_CSS_CACHE))
+    change = GTK_CSS_CHANGE_ANY;
 
   if (!priv->invalid && change == 0)
     return;