diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-07-24 06:02:38 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-07-24 06:02:38 +0000 |
| commit | 5be0a82a353b67160142134de1cc51fa31d72759 (patch) | |
| tree | 333f0e70a6cf4f2cb5252c2e16922a1b6408dc06 /openbox | |
| parent | 230abdc5a0848cd05dc3a007826a2a6b8a73c0a5 (diff) | |
use ob_debug for any debug printing and only display the output when its a debug build or when --debug is passed to it
Diffstat (limited to 'openbox')
| -rw-r--r-- | openbox/action.c | 2 | ||||
| -rw-r--r-- | openbox/client.c | 28 | ||||
| -rw-r--r-- | openbox/debug.h | 2 | ||||
| -rw-r--r-- | openbox/dock.c | 5 | ||||
| -rw-r--r-- | openbox/event.c | 91 | ||||
| -rw-r--r-- | openbox/focus.c | 3 | ||||
| -rw-r--r-- | openbox/menu.c | 6 | ||||
| -rw-r--r-- | openbox/menu_render.c | 10 | ||||
| -rw-r--r-- | openbox/openbox.c | 18 | ||||
| -rw-r--r-- | openbox/screen.c | 17 |
10 files changed, 97 insertions, 85 deletions
diff --git a/openbox/action.c b/openbox/action.c index 5f79a996..d59c5514 100644 --- a/openbox/action.c +++ b/openbox/action.c @@ -1,3 +1,4 @@ +#include "debug.h" #include "client.h" #include "focus.h" #include "moveresize.h" @@ -576,7 +577,6 @@ Action *action_parse(xmlDocPtr doc, xmlNodePtr node) act->func == action_desktop_up || act->func == action_desktop_down) { if ((n = parse_find_node("wrap", node->xmlChildrenNode))) { - g_message("WRAP %d", parse_bool(doc, n)); act->data.desktopdir.wrap = parse_bool(doc, n); } } else if (act->func == action_send_to_desktop_right || diff --git a/openbox/client.c b/openbox/client.c index 7b1b9955..b31c939c 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -1,3 +1,4 @@ +#include "debug.h" #include "client.h" #include "dock.h" #include "xerror.h" @@ -216,7 +217,7 @@ void client_manage(Window window) XFree(wmhint); } - g_message("Managing window: %lx", window); + ob_debug("Managing window: %lx\n", window); /* choose the events we want to receive on the CLIENT window */ attrib_set.event_mask = CLIENT_EVENTMASK; @@ -322,7 +323,7 @@ void client_manage(Window window) dispatch_client(Event_Client_Mapped, self, 0, 0); - g_message("Managed window 0x%lx (%s)", window, self->class); + ob_debug("Managed window 0x%lx (%s)\n", window, self->class); } void client_unmanage_all() @@ -343,7 +344,7 @@ void client_unmanage(ObClient *self) guint j; GSList *it; - g_message("Unmanaging window: %lx (%s)", self->window, self->class); + ob_debug("Unmanaging window: %lx (%s)\n", self->window, self->class); dispatch_client(Event_Client_Destroy, self, 0, 0); g_assert(self != NULL); @@ -434,7 +435,7 @@ void client_unmanage(ObClient *self) } - g_message("Unmanaged window 0x%lx", self->window); + ob_debug("Unmanaged window 0x%lx\n", self->window); /* free all data allocated in the client struct */ g_slist_free(self->transients); @@ -1098,7 +1099,6 @@ static void client_change_allowed_actions(ObClient *self) else self->shaded = FALSE; } if (!(self->functions & OB_CLIENT_FUNC_ICONIFY) && self->iconic) { - g_message("UNSETTING ICONIC"); if (self->frame) client_iconify(self, FALSE, TRUE); else self->iconic = FALSE; } @@ -1191,8 +1191,8 @@ void client_update_wmhints(ObClient *self) if (ur != self->urgent) { self->urgent = ur; - g_message("Urgent Hint for 0x%lx: %s", self->window, - ur ? "ON" : "OFF"); + ob_debug("Urgent Hint for 0x%lx: %s\n", self->window, + ur ? "ON" : "OFF"); /* fire the urgent callback if we're mapped, otherwise, wait until after we're mapped */ if (self->frame) @@ -1905,8 +1905,8 @@ static void client_iconify_recursive(ObClient *self, if (self->iconic != iconic) { - g_message("%sconifying window: 0x%lx", (iconic ? "I" : "Uni"), - self->window); + ob_debug("%sconifying window: 0x%lx\n", (iconic ? "I" : "Uni"), + self->window); self->iconic = iconic; @@ -2126,7 +2126,7 @@ void client_set_desktop_recursive(ObClient *self, if (target != self->desktop) { - g_message("Setting desktop %u", target+1); + ob_debug("Setting desktop %u\n", target+1); g_assert(target < screen_num_desktops || target == DESKTOP_ALL); @@ -2416,9 +2416,9 @@ gboolean client_focus(ObClient *self) } #ifdef DEBUG_FOCUS - g_message("%sively focusing %lx at %d", (self->can_focus ? "act" : "pass"), - self->window, (int) - event_lasttime); + ob_debug("%sively focusing %lx at %d\n", + (self->can_focus ? "act" : "pass"), + self->window, (int) event_lasttime); #endif /* Cause the FocusIn to come back to us. Important for desktop switches, @@ -2432,7 +2432,7 @@ void client_unfocus(ObClient *self) { g_assert(focus_client == self); #ifdef DEBUG_FOCUS - g_message("client_unfocus for %lx", self->window); + ob_debug("client_unfocus for %lx\n", self->window); #endif focus_fallback(OB_FOCUS_FALLBACK_UNFOCUSING); } diff --git a/openbox/debug.h b/openbox/debug.h index 695e968f..0e7ed10f 100644 --- a/openbox/debug.h +++ b/openbox/debug.h @@ -1,6 +1,8 @@ #ifndef __ob__debug_h #define __ob__debug_h +#include <glib.h> + void ob_debug_show_output(gboolean enable); void ob_debug(char *a, ...); diff --git a/openbox/dock.c b/openbox/dock.c index c8f6c9a0..c2190ee2 100644 --- a/openbox/dock.c +++ b/openbox/dock.c @@ -1,3 +1,4 @@ +#include "debug.h" #include "dock.h" #include "screen.h" #include "prop.h" @@ -115,7 +116,7 @@ void dock_add(Window win, XWMHints *wmhints) g_hash_table_insert(window_map, &app->icon_win, app); - g_message("Managed Dock App: 0x%lx (%s)", app->icon_win, app->class); + ob_debug("Managed Dock App: 0x%lx (%s)\n", app->icon_win, app->class); } void dock_remove_all() @@ -141,7 +142,7 @@ void dock_remove(ObDockApp *app, gboolean reparent) dock->dock_apps = g_list_remove(dock->dock_apps, app); dock_configure(); - g_message("Unmanaged Dock App: 0x%lx (%s)", app->icon_win, app->class); + ob_debug("Unmanaged Dock App: 0x%lx (%s)\n", app->icon_win, app->class); g_free(app->name); g_free(app->class); diff --git a/openbox/event.c b/openbox/event.c index 018218fc..fbb7bb66 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1,3 +1,4 @@ +#include "debug.h" #include "openbox.h" #include "dock.h" #include "client.h" @@ -315,8 +316,8 @@ static gboolean event_ignore(XEvent *e, ObClient *client) if (INVALID_FOCUSIN(e) || client == NULL) { #ifdef DEBUG_FOCUS - g_message("FocusIn on %lx mode %d detail %d IGNORED", e->xfocus.window, - e->xfocus.mode, e->xfocus.detail); + ob_debug("FocusIn on %lx mode %d detail %d IGNORED\n", + e->xfocus.window, e->xfocus.mode, e->xfocus.detail); #endif /* says a client was not found for the event (or a valid FocusIn event was not found. @@ -326,22 +327,22 @@ static gboolean event_ignore(XEvent *e, ObClient *client) } #ifdef DEBUG_FOCUS - g_message("FocusIn on %lx mode %d detail %d", e->xfocus.window, - e->xfocus.mode, e->xfocus.detail); + ob_debug("FocusIn on %lx mode %d detail %d\n", e->xfocus.window, + e->xfocus.mode, e->xfocus.detail); #endif break; case FocusOut: if (INVALID_FOCUSOUT(e)) { #ifdef DEBUG_FOCUS - g_message("FocusOut on %lx mode %d detail %d IGNORED", - e->xfocus.window, e->xfocus.mode, e->xfocus.detail); + ob_debug("FocusOut on %lx mode %d detail %d IGNORED\n", + e->xfocus.window, e->xfocus.mode, e->xfocus.detail); #endif return TRUE; } #ifdef DEBUG_FOCUS - g_message("FocusOut on %lx mode %d detail %d", - e->xfocus.window, e->xfocus.mode, e->xfocus.detail); + ob_debug("FocusOut on %lx mode %d detail %d\n", + e->xfocus.window, e->xfocus.mode, e->xfocus.detail); #endif { @@ -355,7 +356,7 @@ static gboolean event_ignore(XEvent *e, ObClient *client) break; if (fe.type == FocusOut) { #ifdef DEBUG_FOCUS - g_message("found pending FocusOut"); + ob_debug("found pending FocusOut"); #endif if (!INVALID_FOCUSOUT(&fe)) { /* if there is a VALID FocusOut still coming, don't @@ -366,7 +367,7 @@ static gboolean event_ignore(XEvent *e, ObClient *client) } } else { #ifdef DEBUG_FOCUS - g_message("found pending FocusIn"); + ob_debug("found pending FocusIn"); #endif /* is the focused window getting a FocusOut/In back to itself? @@ -383,16 +384,16 @@ static gboolean event_ignore(XEvent *e, ObClient *client) */ if (focus_client) { #ifdef DEBUG_FOCUS - g_message("focused window got an Out/In back to " - "itself IGNORED both"); + ob_debug("focused window got an Out/In back to " + "itself IGNORED both"); #endif return TRUE; } else { event_process(&fe); #ifdef DEBUG_FOCUS - g_message("focused window got an Out/In back to " - "itself but focus_client was null " - "IGNORED just the Out"); + ob_debug("focused window got an Out/In back to " + "itself but focus_client was null " + "IGNORED just the Out"); #endif return TRUE; } @@ -411,8 +412,8 @@ static gboolean event_ignore(XEvent *e, ObClient *client) } if (fallback) { #ifdef DEBUG_FOCUS - g_message("no valid FocusIn and no FocusOut events found, " - "falling back"); + ob_debug("no valid FocusIn and no FocusOut events found, " + "falling back"); #endif focus_fallback(OB_FOCUS_FALLBACK_NOFOCUS); } @@ -428,18 +429,18 @@ static gboolean event_ignore(XEvent *e, ObClient *client) (e->xcrossing.mode == NotifyUngrab && e->xcrossing.detail == NotifyVirtual)) { #ifdef DEBUG_FOCUS - g_message("%sNotify mode %d detail %d on %lx IGNORED", - (e->type == EnterNotify ? "Enter" : "Leave"), - e->xcrossing.mode, - e->xcrossing.detail, client?client->window:0); + ob_debug("%sNotify mode %d detail %d on %lx IGNORED", + (e->type == EnterNotify ? "Enter" : "Leave"), + e->xcrossing.mode, + e->xcrossing.detail, client?client->window:0); #endif return TRUE; } #ifdef DEBUG_FOCUS - g_message("%sNotify mode %d detail %d on %lx", - (e->type == EnterNotify ? "Enter" : "Leave"), - e->xcrossing.mode, - e->xcrossing.detail, client?client->window:0); + ob_debug("%sNotify mode %d detail %d on %lx", + (e->type == EnterNotify ? "Enter" : "Leave"), + e->xcrossing.mode, + e->xcrossing.detail, client?client->window:0); #endif break; } @@ -552,7 +553,7 @@ static void event_handle_root(XEvent *e) switch(e->type) { case SelectionClear: - g_message("Another WM has requested to replace us. Exiting."); + ob_debug("Another WM has requested to replace us. Exiting.\n"); ob_exit(); break; @@ -588,7 +589,7 @@ static void event_handle_root(XEvent *e) ; #ifdef VIDMODE if (extensions_vidmode && e->type == extensions_vidmode_event_basep) { - g_message("VIDMODE EVENT"); + ob_debug("VIDMODE EVENT\n"); } #endif } @@ -635,7 +636,7 @@ static void event_handle_client(ObClient *client, XEvent *e) break; case FocusIn: #ifdef DEBUG_FOCUS - g_message("FocusIn on client for %lx", client->window); + ob_debug("FocusIn on client for %lx\n", client->window); #endif if (client != focus_client) { focus_set_client(client); @@ -644,7 +645,7 @@ static void event_handle_client(ObClient *client, XEvent *e) break; case FocusOut: #ifdef DEBUG_FOCUS - g_message("FocusOut on client for %lx", client->window); + ob_debug("FocusOut on client for %lx\n", client->window); #endif /* are we a fullscreen window or a transient of one? (checks layer) if we are then we need to be iconified since we are losing focus @@ -668,8 +669,8 @@ static void event_handle_client(ObClient *client, XEvent *e) client); } else if (config_focus_follow) { #ifdef DEBUG_FOCUS - g_message("EnterNotify on %lx, focusing window", - client->window); + ob_debug("EnterNotify on %lx, focusing window\n", + client->window); #endif client_focus(client); } @@ -782,7 +783,7 @@ static void event_handle_client(ObClient *client, XEvent *e) client_unmanage(client); break; case MapRequest: - g_message("MapRequest for 0x%lx", client->window); + ob_debug("MapRequest for 0x%lx\n", client->window); if (!client->iconic) break; /* this normally doesn't happen, but if it does, we don't want it! */ if (screen_showing_desktop) @@ -836,22 +837,22 @@ static void event_handle_client(ObClient *client, XEvent *e) FALSE); } else if (msgtype == prop_atoms.net_wm_state) { /* can't compress these */ - g_message("net_wm_state %s %ld %ld for 0x%lx", - (e->xclient.data.l[0] == 0 ? "Remove" : - e->xclient.data.l[0] == 1 ? "Add" : - e->xclient.data.l[0] == 2 ? "Toggle" : "INVALID"), - e->xclient.data.l[1], e->xclient.data.l[2], - client->window); + ob_debug("net_wm_state %s %ld %ld for 0x%lx\n", + (e->xclient.data.l[0] == 0 ? "Remove" : + e->xclient.data.l[0] == 1 ? "Add" : + e->xclient.data.l[0] == 2 ? "Toggle" : "INVALID"), + e->xclient.data.l[1], e->xclient.data.l[2], + client->window); client_set_state(client, e->xclient.data.l[0], e->xclient.data.l[1], e->xclient.data.l[2]); } else if (msgtype == prop_atoms.net_close_window) { - g_message("net_close_window for 0x%lx", client->window); + ob_debug("net_close_window for 0x%lx\n", client->window); client_close(client); } else if (msgtype == prop_atoms.net_active_window) { - g_message("net_active_window for 0x%lx", client->window); + ob_debug("net_active_window for 0x%lx\n", client->window); client_activate(client); } else if (msgtype == prop_atoms.net_wm_moveresize) { - g_message("net_wm_moveresize for 0x%lx", client->window); + ob_debug("net_wm_moveresize for 0x%lx\n", client->window); if ((Atom)e->xclient.data.l[2] == prop_atoms.net_wm_moveresize_size_topleft || (Atom)e->xclient.data.l[2] == @@ -978,7 +979,7 @@ static void event_handle_menu(ObClient *client, XEvent *e) top = g_list_nth_data(menu_visible, 0); - g_message("EVENT %d", e->type); + ob_debug("EVENT %d\n", e->type); switch (e->type) { case KeyPress: if (e->xkey.keycode == ob_keycode(OB_KEY_DOWN)) @@ -1009,12 +1010,12 @@ static void event_handle_menu(ObClient *client, XEvent *e) case ButtonPress: if (e->xbutton.button > 3) break; - g_message("BUTTON PRESS"); + ob_debug("BUTTON PRESS\n"); break; case ButtonRelease: if (e->xbutton.button > 3) break; - g_message("BUTTON RELEASED"); + ob_debug("BUTTON RELEASED\n"); for (it = menu_visible; it; it = g_list_next(it)) { ObMenu *m = it->data; @@ -1062,7 +1063,7 @@ static void event_handle_menu(ObClient *client, XEvent *e) break; case MotionNotify: - g_message("motion"); + ob_debug("motion\n"); for (it = menu_visible; it; it = g_list_next(it)) { ObMenu *m = it->data; if ((entry = menu_find_entry_by_pos(it->data, diff --git a/openbox/focus.c b/openbox/focus.c index a04e4d40..dfa9c42d 100644 --- a/openbox/focus.c +++ b/openbox/focus.c @@ -1,3 +1,4 @@ +#include "debug.h" #include "event.h" #include "openbox.h" #include "grab.h" @@ -64,7 +65,7 @@ void focus_set_client(ObClient *client) ObClient *old; #ifdef DEBUG_FOCUS - g_message("focus_set_client 0x%lx", client ? client->window : 0); + ob_debug("focus_set_client 0x%lx\n", client ? client->window : 0); #endif /* uninstall the old colormap, and install the new one */ diff --git a/openbox/menu.c b/openbox/menu.c index 4c7adc92..fabfc85a 100644 --- a/openbox/menu.c +++ b/openbox/menu.c @@ -1,3 +1,4 @@ +#include "debug.h" #include "menu.h" #include "openbox.h" #include "stacking.h" @@ -37,7 +38,7 @@ void parse_menu_full(xmlDocPtr doc, xmlNodePtr node, void *data, goto parse_menu_fail; if (!parse_attr_string("label", node, &title)) goto parse_menu_fail; - g_message("menu label %s", title); + ob_debug("menu label %s\n", title); if (parse_attr_string("plugin", node, &plugin)) { PluginMenuCreateData data; @@ -431,7 +432,8 @@ ObMenuEntry *menu_find_entry_by_pos(ObMenu *menu, int x, int y) y -= menu->title_h + ob_rr_theme->bwidth; if (y < 0) return NULL; - g_message ("%d %p", y/menu->item_h, g_list_nth_data(menu->entries, y / menu->item_h)); + ob_debug("%d %p\n", y/menu->item_h, + g_list_nth_data(menu->entries, y / menu->item_h)); return g_list_nth_data(menu->entries, y / menu->item_h); } diff --git a/openbox/menu_render.c b/openbox/menu_render.c index d5342534..d3a5373f 100644 --- a/openbox/menu_render.c +++ b/openbox/menu_render.c @@ -1,5 +1,6 @@ /* Functions for default rendering of menus. Might become pluginnable */ +#include "debug.h" #include "menu.h" #include "openbox.h" #include "render/theme.h" @@ -125,15 +126,10 @@ void menu_entry_render(ObMenuEntry *self) break; default: - g_message("unhandled render_type"); - a = !self->enabled ? self->a_disabled : - (self->hilite && - (self->action || - self->render_type == OB_MENU_ENTRY_RENDER_TYPE_SUBMENU) ? - self->a_hilite : self->a_item); + g_assert_not_reached(); /* unhandled rendering type */ break; } - g_message ("%s %d", self->label, self->hilite); + ob_debug("%s %d\n", self->label, self->hilite); XMoveResizeWindow(ob_display, self->item, 0, self->y, menu->size.width, menu->item_h); 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 diff --git a/openbox/screen.c b/openbox/screen.c index 3e3b9632..59212da1 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -1,3 +1,4 @@ +#include "debug.h" #include "openbox.h" #include "dock.h" #include "xerror.h" @@ -65,7 +66,7 @@ static gboolean replace_wm() current_wm_sn_owner = XGetSelectionOwner(ob_display, wm_sn_atom); if (current_wm_sn_owner) { if (!ob_replace_wm) { - g_message("A window manager is already running on screen %d", + g_warning("A window manager is already running on screen %d", ob_screen); return FALSE; } @@ -102,7 +103,7 @@ static gboolean replace_wm() timestamp); if (XGetSelectionOwner(ob_display, wm_sn_atom) != screen_support_win) { - g_message("Could not acquire window manager selection on screen %d", + g_warning("Could not acquire window manager selection on screen %d", ob_screen); return FALSE; } @@ -123,7 +124,7 @@ static gboolean replace_wm() } if (wait >= timeout) { - g_message("Timeout expired while waiting for the current WM to die " + g_warning("Timeout expired while waiting for the current WM to die " "on screen %d", ob_screen); return FALSE; } @@ -165,7 +166,7 @@ gboolean screen_annex() ROOT_EVENTMASK); xerror_set_ignore(FALSE); if (xerror_occured) { - g_message("A window manager is already running on screen %d", + g_warning("A window manager is already running on screen %d", ob_screen); XDestroyWindow(ob_display, screen_support_win); @@ -173,7 +174,7 @@ gboolean screen_annex() } - g_message("Managing screen %d", ob_screen); + ob_debug("Managing screen %d\n", ob_screen); set_root_cursor(); @@ -426,7 +427,7 @@ void screen_set_desktop(guint num) if (old == num) return; - g_message("Moving to desktop %d", num+1); + ob_debug("Moving to desktop %d\n", num+1); /* show windows before hiding the rest to lessen the enter/leave events */ @@ -452,11 +453,11 @@ void screen_set_desktop(guint num) from the switch so it doesnt mess with the focus */ while (XCheckTypedEvent(ob_display, EnterNotify, &e)); #ifdef DEBUG_FOCUS - g_message("switch fallback"); + ob_debug("switch fallback\n"); #endif focus_fallback(OB_FOCUS_FALLBACK_DESKTOP); #ifdef DEBUG_FOCUS - g_message("/switch fallback"); + ob_debug("/switch fallback\n"); #endif dispatch_ob(Event_Ob_Desktop, num, old); |
