Commit 0a9e2d6e authored by Vanadiae's avatar Vanadiae

gtk-debug: Allow interactive debug even without G_ENABLE_DEBUG

Currently when GTK3 is compiled without G_ENABLE_DEBUG, the inspector
can't be opened with GTK_DEBUG=interactive because it doesn't parse
this env var without G_ENABLE_DEBUG.

Since the inspector is always good to have, this commit now always
parses the GTK_DEBUG env var but only keep the "interactive" flag if
G_ENABLE_DEBUG isn't defined.
parent 395b30dc
......@@ -134,9 +134,9 @@ additional environment variables.
<title><envar>GTK_DEBUG</envar></title>
<para>
Unless GTK+ has been configured with <option>--enable-debug=no</option>,
this variable can be set to a list of debug options, which cause GTK+
to print out different types of debugging information.
This variable can be set to a list of debug options, which cause GTK to
print out different types of debugging information. Some of these options
are only available when GTK has been configured with <option>--enable-debug=yes</option>.
<variablelist>
<varlistentry>
<term>actions</term>
......
......@@ -167,7 +167,6 @@ typedef struct {
DisplayDebugFlags debug_flags[N_DEBUG_DISPLAYS];
#ifdef G_ENABLE_DEBUG
static const GDebugKey gtk_debug_keys[] = {
{ "misc", GTK_DEBUG_MISC },
{ "plugsocket", GTK_DEBUG_PLUGSOCKET },
......@@ -192,7 +191,6 @@ static const GDebugKey gtk_debug_keys[] = {
{ "resize", GTK_DEBUG_RESIZE },
{ "layout", GTK_DEBUG_LAYOUT }
};
#endif /* G_ENABLE_DEBUG */
/**
* gtk_get_major_version:
......@@ -660,12 +658,15 @@ do_pre_parse_initialization (int *argc,
env_string = g_getenv ("GTK_DEBUG");
if (env_string != NULL)
{
#ifdef G_ENABLE_DEBUG
debug_flags[0].flags = g_parse_debug_string (env_string,
gtk_debug_keys,
G_N_ELEMENTS (gtk_debug_keys));
#else
g_warning ("GTK_DEBUG set but ignored because gtk isn't built with G_ENABLE_DEBUG");
#ifndef G_ENABLE_DEBUG
/* No need to print the warning for "interactive" since it's kept anyway. */
if (debug_flags[0].flags != GTK_DEBUG_INTERACTIVE)
g_warning ("GTK_DEBUG set but ignored because gtk isn't built with G_ENABLE_DEBUG");
/* Only keep "interactive" if not with G_ENABLE_DEBUG. */
debug_flags[0].flags &= GTK_DEBUG_INTERACTIVE;
#endif /* G_ENABLE_DEBUG */
env_string = NULL;
}
......
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