summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2012-05-02 01:59:15 +0200
committerBenjamin Otte <otte@redhat.com>2012-05-02 02:00:11 +0200
commit793748eaddd4675e9e3289c67ae27d6098882db0 (patch)
tree82f8471e8415bca2c15e42b1731d2d4352640a9c
parentb0317280e7ff5428120648a160a462ef83f48fd3 (diff)
downloadgtk+-793748eaddd4675e9e3289c67ae27d6098882db0.tar.gz
debug: Add GTK_DEBUG=no-css-cache
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.
-rw-r--r--docs/reference/gtk/running.sgml8
-rw-r--r--gtk/gtkdebug.h3
-rw-r--r--gtk/gtkmain.c1
-rw-r--r--gtk/gtkstylecontext.c16
4 files changed, 27 insertions, 1 deletions
diff --git a/docs/reference/gtk/running.sgml b/docs/reference/gtk/running.sgml
index fe91aead74..3e4966af0e 100644
--- a/docs/reference/gtk/running.sgml
+++ b/docs/reference/gtk/running.sgml
@@ -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
diff --git a/gtk/gtkdebug.h b/gtk/gtkdebug.h
index b1eb70a020..1eed41a2b9 100644
--- a/gtk/gtkdebug.h
+++ b/gtk/gtkdebug.h
@@ -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
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 65df934ccb..c9f91736b7 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -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 */
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 5fd398eaa9..ece1b8db0a 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -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;