Merge branch 'gtk_dbg_interactive_gtk3_backport' into 'gtk-3-24'

Allow GTK_DEBUG=interactive even without G_ENABLE_DEBUG defined

See merge request GNOME/gtk!3090
This commit is contained in:
Matthias Clasen 2021-01-18 19:41:25 +00:00
commit aec4dc9387
2 changed files with 9 additions and 8 deletions

View File

@ -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>

View File

@ -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;
}