From 5be0a82a353b67160142134de1cc51fa31d72759 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Thu, 24 Jul 2003 06:02:38 +0000 Subject: use ob_debug for any debug printing and only display the output when its a debug build or when --debug is passed to it --- openbox/openbox.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'openbox/openbox.c') diff --git a/openbox/openbox.c b/openbox/openbox.c index 4b248a0c..9b79438c 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -1,3 +1,4 @@ +#include "debug.h" #include "openbox.h" #include "dock.h" #include "event.h" @@ -92,6 +93,10 @@ int main(int argc, char **argv) xmlDocPtr doc; xmlNodePtr node; +#ifdef DEBUG + ob_debug_show_output(TRUE); +#endif + state = OB_STATE_STARTING; /* initialize the locale */ @@ -430,7 +435,7 @@ static void sm_startup(int argc, char **argv) g_free(prop_cmd.vals); g_free(prop_res.vals); - g_message("Connected to session manager with id %s", ob_sm_id); + ob_debug("Connected to session manager with id %s\n", ob_sm_id); } g_free (ob_sm_id); #endif @@ -510,6 +515,7 @@ static void print_help() g_print(" --version Display the version and exit\n"); g_print(" --sync Run in synchronous mode (this is slow and\n" " meant for debugging X routines)\n"); + g_print(" --debug Display debugging output\n"); g_print("\nPlease report bugs at %s\n", PACKAGE_BUGREPORT); } @@ -530,6 +536,8 @@ static void parse_args(int argc, char **argv) ob_replace_wm = TRUE; } else if (!strcmp(argv[i], "--sync")) { xsync = TRUE; + } else if (!strcmp(argv[i], "--debug")) { + ob_debug_show_output(TRUE); #ifdef USE_SM } else if (!strcmp(argv[i], "--sm-client-id")) { if (i == argc - 1) /* no args left */ @@ -551,24 +559,24 @@ static void parse_args(int argc, char **argv) static void sm_save_yourself(SmcConn conn, SmPointer data, int save_type, Bool shutdown, int interact_style, Bool fast) { - g_message("got SAVE YOURSELF from session manager"); + ob_debug("got SAVE YOURSELF from session manager\n"); SmcSaveYourselfDone(conn, TRUE); } static void sm_die(SmcConn conn, SmPointer data) { ob_exit(); - g_message("got DIE from session manager"); + ob_debug("got DIE from session manager\n"); } static void sm_save_complete(SmcConn conn, SmPointer data) { - g_message("got SAVE COMPLETE from session manager"); + ob_debug("got SAVE COMPLETE from session manager\n"); } static void sm_shutdown_cancelled(SmcConn conn, SmPointer data) { - g_message("got SHUTDOWN CANCELLED from session manager"); + ob_debug("got SHUTDOWN CANCELLED from session manager\n"); } #endif -- cgit v1.2.3