[gtk+] debug: Add GTK_DEBUG=no-css-cache
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] debug: Add GTK_DEBUG=no-css-cache
- Date: Wed, 2 May 2012 00:04:19 +0000 (UTC)
commit 793748eaddd4675e9e3289c67ae27d6098882db0
Author: Benjamin Otte <otte redhat com>
Date: Wed May 2 01:59:15 2012 +0200
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.
docs/reference/gtk/running.sgml | 8 ++++++++
gtk/gtkdebug.h | 3 ++-
gtk/gtkmain.c | 1 +
gtk/gtkstylecontext.c | 16 ++++++++++++++++
4 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/docs/reference/gtk/running.sgml b/docs/reference/gtk/running.sgml
index fe91aea..3e4966a 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 b1eb70a..1eed41a 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 65df934..c9f9173 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 5fd398e..ece1b8d 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]