mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
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.
This commit is contained in:
parent
2fbc8c20c1
commit
62dba86c81
@ -42,20 +42,31 @@ time by the --enable-debug option.
|
||||
RUN TIME OPTIONS
|
||||
----------------
|
||||
|
||||
At run time, if GTK+ was compiled with debugging enabled,
|
||||
different types of debugging information can be printed
|
||||
out by setting the --gtk-debug and --gdk-debug command line
|
||||
options, or the GTK_DEBUG and GDK_DEBUG environment
|
||||
variables. (The command line options override the environment
|
||||
variables)
|
||||
At run time, if GTK+ was compiled with debugging enabled, different
|
||||
types of debugging information can be printed out. This is controlled
|
||||
by the:
|
||||
|
||||
GTK_DEBUG and GDK_DEBUG environment variables
|
||||
--gtk-debug and --gdk-debug command line options
|
||||
--gtk-no-debug and --gdk-no-debug command line options
|
||||
|
||||
Each of these can either be the special value ALL,
|
||||
or a sequence of ':' separated options. (Note, case is
|
||||
significant)
|
||||
First the environment variables are applied, then the command line
|
||||
options are applied in the order given on the command line.
|
||||
|
||||
As noted below, some of these are useful in application
|
||||
debugging, but most are only interested to those debugging
|
||||
the libraries
|
||||
Each of these can either be the special value ALL, or a sequence of
|
||||
':' separated options. (Note, case is significant). The environment
|
||||
variables and the --gtk-debug and --gdk-debug options add debugging
|
||||
options and the --gtk-no-debug and --gdk-no-debug options remove
|
||||
them.
|
||||
|
||||
As noted below, some of these are useful in application debugging, but
|
||||
most are only interested to those debugging the libraries
|
||||
|
||||
For instance:
|
||||
|
||||
GDK_DEBUG_FLAGS=misc:dnd testgtk --gdk-no-debug dnd --gdk-debug events
|
||||
|
||||
runs testgtk with the 'misc' and 'events' debugging options.
|
||||
|
||||
GTK_DEBUG
|
||||
---------
|
||||
@ -81,3 +92,7 @@ the libraries
|
||||
'color-context' - Information about the internal workings of
|
||||
GdkColorContext
|
||||
'xim' - Information about X Input Method support
|
||||
|
||||
|
||||
- Owen Taylor <owt1@cornell.edu>
|
||||
98/02/19
|
63
gdk/gdk.c
63
gdk/gdk.c
@ -233,6 +233,9 @@ static GDebugKey gdk_debug_keys[] = {
|
||||
{"color-context", GDK_DEBUG_COLOR_CONTEXT},
|
||||
{"xim", GDK_DEBUG_XIM}
|
||||
};
|
||||
|
||||
static const int gdk_ndebug_keys = sizeof(gdk_debug_keys)/sizeof(GDebugKey);
|
||||
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
/*
|
||||
@ -267,10 +270,6 @@ gdk_init (int *argc,
|
||||
int argc_orig = *argc;
|
||||
char **argv_orig;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
gboolean debug_set = FALSE;
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
argv_orig = malloc ((argc_orig + 1) * sizeof (char*));
|
||||
for (i = 0; i < argc_orig; i++)
|
||||
argv_orig[i] = g_strdup ((*argv)[i]);
|
||||
@ -295,6 +294,16 @@ gdk_init (int *argc,
|
||||
|
||||
synchronize = FALSE;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
{
|
||||
gchar *debug_string = getenv("GDK_DEBUG");
|
||||
if (debug_string != NULL)
|
||||
gdk_debug_flags = g_parse_debug_string (debug_string,
|
||||
gdk_debug_keys,
|
||||
gdk_ndebug_keys);
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
if (argc && argv)
|
||||
{
|
||||
if (*argc > 0)
|
||||
@ -303,7 +312,10 @@ gdk_init (int *argc,
|
||||
for (i = 1; i < *argc;)
|
||||
{
|
||||
if ((*argv)[i] == NULL)
|
||||
continue;
|
||||
{
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (strcmp ("--gdk-debug", (*argv)[i]) == 0)
|
||||
@ -312,15 +324,27 @@ gdk_init (int *argc,
|
||||
|
||||
if ((i + 1) < *argc && (*argv)[i + 1])
|
||||
{
|
||||
gdk_debug_flags = g_parse_debug_string ((*argv)[i+1],
|
||||
gdk_debug_keys,
|
||||
sizeof(gdk_debug_keys) / sizeof(GDebugKey));
|
||||
debug_set = TRUE;
|
||||
gdk_debug_flags |= g_parse_debug_string ((*argv)[i+1],
|
||||
gdk_debug_keys,
|
||||
gdk_ndebug_keys);
|
||||
(*argv)[i + 1] = NULL;
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
#endif G_ENABLE_DEBUG
|
||||
else if (strcmp ("--gdk-no-debug", (*argv)[i]) == 0)
|
||||
{
|
||||
(*argv)[i] = NULL;
|
||||
|
||||
if ((i + 1) < *argc && (*argv)[i + 1])
|
||||
{
|
||||
gdk_debug_flags &= ~g_parse_debug_string ((*argv)[i+1],
|
||||
gdk_debug_keys,
|
||||
gdk_ndebug_keys);
|
||||
(*argv)[i + 1] = NULL;
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
else if (strcmp ("--display", (*argv)[i]) == 0)
|
||||
{
|
||||
(*argv)[i] = NULL;
|
||||
@ -438,17 +462,6 @@ gdk_init (int *argc,
|
||||
gdk_progname = "<unknown>";
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (!debug_set)
|
||||
{
|
||||
gchar *debug_string = getenv("GDK_DEBUG");
|
||||
if (debug_string != NULL)
|
||||
gdk_debug_flags = g_parse_debug_string (debug_string,
|
||||
gdk_debug_keys,
|
||||
sizeof(gdk_debug_keys) / sizeof(GDebugKey));
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
gdk_display = XOpenDisplay (gdk_display_name);
|
||||
if (!gdk_display)
|
||||
{
|
||||
@ -2180,12 +2193,14 @@ gdk_event_translate (GdkEvent *event,
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if ((gdk_debug_flags & GDK_DEBUG_DND) & dnd_drag_perhaps)
|
||||
{
|
||||
g_print("We may[%d] have a drag into %#lx = %#lx\n",
|
||||
gdk_dnd.drag_really,
|
||||
xevent->xcrossing.window, real_sw->xwindow);
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
if (dnd_drag_perhaps && gdk_dnd.drag_really &&
|
||||
(xevent->xcrossing.window == real_sw->xwindow))
|
||||
@ -2247,12 +2262,14 @@ gdk_event_translate (GdkEvent *event,
|
||||
event->crossing.detail = GDK_NOTIFY_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if ((gdk_debug_flags & GDK_DEBUG_DND) & dnd_drag_perhaps)
|
||||
{
|
||||
g_print("We may[%d] have a drag out of %#lx = %#lx\n",
|
||||
gdk_dnd.drag_really,
|
||||
xevent->xcrossing.window, real_sw->xwindow);
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
if (dnd_drag_perhaps && !gdk_dnd.drag_really &&
|
||||
(xevent->xcrossing.window == real_sw->xwindow))
|
||||
{
|
||||
@ -2361,6 +2378,7 @@ gdk_event_translate (GdkEvent *event,
|
||||
case VisibilityNotify:
|
||||
/* Print debugging info.
|
||||
*/
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (gdk_debug_flags & GDK_DEBUG_EVENTS)
|
||||
switch (xevent->xvisibility.state)
|
||||
{
|
||||
@ -2377,6 +2395,7 @@ gdk_event_translate (GdkEvent *event,
|
||||
xevent->xvisibility.window - base_id);
|
||||
break;
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
event->visibility.type = GDK_VISIBILITY_NOTIFY;
|
||||
event->visibility.window = window;
|
||||
@ -3552,10 +3571,12 @@ gdk_ic_cleanup (void)
|
||||
destroyed++;
|
||||
}
|
||||
}
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if ((gdk_debug_flags & GDK_DEBUG_XIM) && destroyed > 0)
|
||||
{
|
||||
g_warning ("Cleaned up %i IC(s)\n", destroyed);
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
g_list_free(xim_ic_list);
|
||||
xim_ic_list = NULL;
|
||||
}
|
||||
|
@ -233,6 +233,9 @@ static GDebugKey gdk_debug_keys[] = {
|
||||
{"color-context", GDK_DEBUG_COLOR_CONTEXT},
|
||||
{"xim", GDK_DEBUG_XIM}
|
||||
};
|
||||
|
||||
static const int gdk_ndebug_keys = sizeof(gdk_debug_keys)/sizeof(GDebugKey);
|
||||
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
/*
|
||||
@ -267,10 +270,6 @@ gdk_init (int *argc,
|
||||
int argc_orig = *argc;
|
||||
char **argv_orig;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
gboolean debug_set = FALSE;
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
argv_orig = malloc ((argc_orig + 1) * sizeof (char*));
|
||||
for (i = 0; i < argc_orig; i++)
|
||||
argv_orig[i] = g_strdup ((*argv)[i]);
|
||||
@ -295,6 +294,16 @@ gdk_init (int *argc,
|
||||
|
||||
synchronize = FALSE;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
{
|
||||
gchar *debug_string = getenv("GDK_DEBUG");
|
||||
if (debug_string != NULL)
|
||||
gdk_debug_flags = g_parse_debug_string (debug_string,
|
||||
gdk_debug_keys,
|
||||
gdk_ndebug_keys);
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
if (argc && argv)
|
||||
{
|
||||
if (*argc > 0)
|
||||
@ -303,7 +312,10 @@ gdk_init (int *argc,
|
||||
for (i = 1; i < *argc;)
|
||||
{
|
||||
if ((*argv)[i] == NULL)
|
||||
continue;
|
||||
{
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (strcmp ("--gdk-debug", (*argv)[i]) == 0)
|
||||
@ -312,15 +324,27 @@ gdk_init (int *argc,
|
||||
|
||||
if ((i + 1) < *argc && (*argv)[i + 1])
|
||||
{
|
||||
gdk_debug_flags = g_parse_debug_string ((*argv)[i+1],
|
||||
gdk_debug_keys,
|
||||
sizeof(gdk_debug_keys) / sizeof(GDebugKey));
|
||||
debug_set = TRUE;
|
||||
gdk_debug_flags |= g_parse_debug_string ((*argv)[i+1],
|
||||
gdk_debug_keys,
|
||||
gdk_ndebug_keys);
|
||||
(*argv)[i + 1] = NULL;
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
#endif G_ENABLE_DEBUG
|
||||
else if (strcmp ("--gdk-no-debug", (*argv)[i]) == 0)
|
||||
{
|
||||
(*argv)[i] = NULL;
|
||||
|
||||
if ((i + 1) < *argc && (*argv)[i + 1])
|
||||
{
|
||||
gdk_debug_flags &= ~g_parse_debug_string ((*argv)[i+1],
|
||||
gdk_debug_keys,
|
||||
gdk_ndebug_keys);
|
||||
(*argv)[i + 1] = NULL;
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
else if (strcmp ("--display", (*argv)[i]) == 0)
|
||||
{
|
||||
(*argv)[i] = NULL;
|
||||
@ -438,17 +462,6 @@ gdk_init (int *argc,
|
||||
gdk_progname = "<unknown>";
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (!debug_set)
|
||||
{
|
||||
gchar *debug_string = getenv("GDK_DEBUG");
|
||||
if (debug_string != NULL)
|
||||
gdk_debug_flags = g_parse_debug_string (debug_string,
|
||||
gdk_debug_keys,
|
||||
sizeof(gdk_debug_keys) / sizeof(GDebugKey));
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
gdk_display = XOpenDisplay (gdk_display_name);
|
||||
if (!gdk_display)
|
||||
{
|
||||
@ -2180,12 +2193,14 @@ gdk_event_translate (GdkEvent *event,
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if ((gdk_debug_flags & GDK_DEBUG_DND) & dnd_drag_perhaps)
|
||||
{
|
||||
g_print("We may[%d] have a drag into %#lx = %#lx\n",
|
||||
gdk_dnd.drag_really,
|
||||
xevent->xcrossing.window, real_sw->xwindow);
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
if (dnd_drag_perhaps && gdk_dnd.drag_really &&
|
||||
(xevent->xcrossing.window == real_sw->xwindow))
|
||||
@ -2247,12 +2262,14 @@ gdk_event_translate (GdkEvent *event,
|
||||
event->crossing.detail = GDK_NOTIFY_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if ((gdk_debug_flags & GDK_DEBUG_DND) & dnd_drag_perhaps)
|
||||
{
|
||||
g_print("We may[%d] have a drag out of %#lx = %#lx\n",
|
||||
gdk_dnd.drag_really,
|
||||
xevent->xcrossing.window, real_sw->xwindow);
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
if (dnd_drag_perhaps && !gdk_dnd.drag_really &&
|
||||
(xevent->xcrossing.window == real_sw->xwindow))
|
||||
{
|
||||
@ -2361,6 +2378,7 @@ gdk_event_translate (GdkEvent *event,
|
||||
case VisibilityNotify:
|
||||
/* Print debugging info.
|
||||
*/
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (gdk_debug_flags & GDK_DEBUG_EVENTS)
|
||||
switch (xevent->xvisibility.state)
|
||||
{
|
||||
@ -2377,6 +2395,7 @@ gdk_event_translate (GdkEvent *event,
|
||||
xevent->xvisibility.window - base_id);
|
||||
break;
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
event->visibility.type = GDK_VISIBILITY_NOTIFY;
|
||||
event->visibility.window = window;
|
||||
@ -3552,10 +3571,12 @@ gdk_ic_cleanup (void)
|
||||
destroyed++;
|
||||
}
|
||||
}
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if ((gdk_debug_flags & GDK_DEBUG_XIM) && destroyed > 0)
|
||||
{
|
||||
g_warning ("Cleaned up %i IC(s)\n", destroyed);
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
g_list_free(xim_ic_list);
|
||||
xim_ic_list = NULL;
|
||||
}
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
|
||||
/* Other stuff */
|
||||
#undef G_COMPILED_WITH_DEBUGGING
|
||||
#undef HAVE_BROKEN_WCTYPE
|
||||
#undef HAVE_DOPRNT
|
||||
#undef HAVE_FLOAT_H
|
||||
|
@ -32,6 +32,8 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(G_COMPILED_WITH_DEBUGGING, "${enable_debug}")
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AM_PROG_CC_STDC
|
||||
|
@ -3,6 +3,9 @@
|
||||
/* Define to empty if the keyword does not work. */
|
||||
#undef const
|
||||
|
||||
/* Force recompilation when --enable-debug value changes */
|
||||
#undef G_COMPILED_WITH_DEBUGGING
|
||||
|
||||
/* Define if you don't have vprintf but do have _doprnt. */
|
||||
#undef HAVE_DOPRNT
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user