Commit 793748ea authored by Benjamin Otte's avatar Benjamin Otte

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.
parent b0317280
......@@ -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
......
......@@ -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
......
......@@ -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 */
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment