diff options
author | Owen Taylor <owt1@cornell.edu> | 1998-02-19 18:02:03 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 1998-02-19 18:02:03 +0000 |
commit | 62dba86c81debf2677230c674902ddb98ba8e4c2 (patch) | |
tree | 781ccb454bb271a1d3bcab499b9af30e9a9bfccf /gtk/gtkmain.c | |
parent | 2fbc8c20c169c6f931a773026b8ca19bba484646 (diff) | |
download | gdk-pixbuf-62dba86c81debf2677230c674902ddb98ba8e4c2.tar.gz |
the value of ---enable_debug is written into glibconfig.h so everything is
Thu Feb 19 12:18:24 1998 Owen Taylor <owt1@cornell.edu>
* glib/configure.in glib/glibconfig.h.in: the value of
---enable_debug is written into glibconfig.h so everything
is recompiled when it changes. (HACK)
* gtk/gtkmain.c gdk/gdk.c docs/debugging.txt:
Added --gdk-no-debug and --gtk-no-debug switches. Effect
of switches is no cumulative.
Diffstat (limited to 'gtk/gtkmain.c')
-rw-r--r-- | gtk/gtkmain.c | 56 |
1 files changed, 38 insertions, 18 deletions
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 90ce42cc0..3e1cd8c43 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -141,22 +141,24 @@ static GdkColormap *gtk_colormap; /* The colormap to be used in creating new * widgets. */ -guint gtk_debug_flags; /* Global GTK debug flag */ +guint gtk_debug_flags = 0; /* Global GTK debug flag */ #ifdef G_ENABLE_DEBUG static GDebugKey gtk_debug_keys[] = { {"objects", GTK_DEBUG_OBJECTS} }; + +static const int gtk_ndebug_keys = sizeof(gtk_debug_keys)/sizeof(GDebugKey); + #endif /* G_ENABLE_DEBUG */ + + + void gtk_init (int *argc, char ***argv) { -#ifdef G_ENABLE_DEBUG - gboolean debug_set = FALSE; -#endif - if (0) { g_set_error_handler (gtk_error); @@ -171,22 +173,48 @@ gtk_init (int *argc, gdk_init (argc, argv); #ifdef G_ENABLE_DEBUG + { + gchar *debug_string = getenv("GTK_DEBUG"); + if (debug_string != NULL) + gtk_debug_flags = g_parse_debug_string (debug_string, + gtk_debug_keys, + gtk_ndebug_keys); + } + if (argc && argv) { gint i; for (i = 1; i < *argc;) { - if ((*argv[i]) && strcmp ("--gtk-debug", (*argv)[i]) == 0) + if ((*argv)[i] == NULL) + { + i += 1; + continue; + } + + if (strcmp ("--gtk-debug", (*argv)[i]) == 0) { (*argv)[i] = NULL; if ((i + 1) < *argc && (*argv)[i + 1]) { - gtk_debug_flags = g_parse_debug_string ((*argv)[i+1], - gtk_debug_keys, - sizeof(gtk_debug_keys) / sizeof(GDebugKey)); - debug_set = TRUE; + gtk_debug_flags |= g_parse_debug_string ((*argv)[i+1], + gtk_debug_keys, + gtk_ndebug_keys); + (*argv)[i + 1] = NULL; + i += 1; + } + } + else if (strcmp ("--gtk-no-debug", (*argv)[i]) == 0) + { + (*argv)[i] = NULL; + + if ((i + 1) < *argc && (*argv)[i + 1]) + { + gtk_debug_flags &= ~g_parse_debug_string ((*argv)[i+1], + gtk_debug_keys, + gtk_ndebug_keys); (*argv)[i + 1] = NULL; i += 1; } @@ -195,14 +223,6 @@ gtk_init (int *argc, } } - if (!debug_set) - { - gchar *debug_string = getenv("GTK_DEBUG"); - if (debug_string != NULL) - gtk_debug_flags = g_parse_debug_string (debug_string, - gtk_debug_keys, - sizeof(gtk_debug_keys) / sizeof(GDebugKey)); - } #endif /* G_ENABLE_DEBUG */ /* Initialize the default visual and colormap to be |