From 5be0a82a353b67160142134de1cc51fa31d72759 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Thu, 24 Jul 2003 06:02:38 +0000 Subject: [PATCH] use ob_debug for any debug printing and only display the output when its a debug build or when --debug is passed to it --- configure.ac | 5 +- openbox/action.c | 2 +- openbox/client.c | 28 +++++------ openbox/debug.h | 2 + openbox/dock.c | 5 +- openbox/event.c | 91 ++++++++++++++++++------------------ openbox/focus.c | 3 +- openbox/menu.c | 6 ++- openbox/menu_render.c | 10 ++-- openbox/openbox.c | 18 +++++-- openbox/screen.c | 17 +++---- parser/parse.c | 2 +- plugins/keyboard/keyboard.c | 2 +- plugins/keyboard/translate.c | 6 +-- plugins/menu/client_menu.c | 11 +++-- plugins/placement/history.c | 3 +- render/color.c | 19 +++----- render/gradient.c | 5 +- render/instance.c | 1 - render/theme.c | 5 +- tools/obconf/main.c | 9 ++-- 21 files changed, 129 insertions(+), 121 deletions(-) diff --git a/configure.ac b/configure.ac index 2c627735..2d67c60c 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ([2.54]) -AC_INIT([openbox], [3.0-alpha2], [http://bugzilla.icculus.org]) +AC_INIT([openbox], [3.0-alpha2a-ex-plus], [http://bugzilla.icculus.org]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([kernel/openbox.c]) @@ -84,7 +84,8 @@ PKG_CHECK_MODULES(GTK, [gtk+-2.0], AC_MSG_WARN([disabling build of the configuration tool]) ] ) -AM_CONDITIONAL(OBCONF, [test "$use_gtk" = "yes" && test "$use_glade" = "yes"]) +#AM_CONDITIONAL(OBCONF, [test "$use_gtk" = "yes" && test "$use_glade" = "yes"]) +AM_CONDITIONAL(OBCONF, [false]) # Check for session management X11_SM 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 + 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); diff --git a/parser/parse.c b/parser/parse.c index 72643652..07ce0736 100644 --- a/parser/parse.c +++ b/parser/parse.c @@ -59,7 +59,7 @@ gboolean parse_load_rc(xmlDocPtr *doc, xmlNodePtr *root) } g_free(path); if (!r) - g_message("unable to find a valid config file, using defaults"); + g_warning("unable to find a valid config file, using defaults"); return r; } diff --git a/plugins/keyboard/keyboard.c b/plugins/keyboard/keyboard.c index 33f8409e..a583a2e6 100644 --- a/plugins/keyboard/keyboard.c +++ b/plugins/keyboard/keyboard.c @@ -146,7 +146,7 @@ gboolean kbind(GList *keylist, Action *action) while (t->first_child) t = t->first_child; if (conflict) { - g_message("conflict with binding"); + g_warning("conflict with binding"); tree_destroy(tree); return FALSE; } diff --git a/plugins/keyboard/translate.c b/plugins/keyboard/translate.c index 05887e6b..7cda04c3 100644 --- a/plugins/keyboard/translate.c +++ b/plugins/keyboard/translate.c @@ -15,7 +15,7 @@ static guint translate_modifier(char *str) !g_ascii_strcasecmp("C", str)) return ControlMask; else if (!g_ascii_strcasecmp("Shift", str) || !g_ascii_strcasecmp("S", str)) return ShiftMask; - g_message("Invalid modifier '%s' in binding.", str); + g_warning("Invalid modifier '%s' in binding.", str); return 0; } @@ -47,12 +47,12 @@ gboolean translate_key(char *str, guint *state, guint *keycode) /* figure out the keycode */ sym = XStringToKeysym(l); if (sym == NoSymbol) { - g_message("Invalid key name '%s' in key binding.", l); + g_warning("Invalid key name '%s' in key binding.", l); goto translation_fail; } *keycode = XKeysymToKeycode(ob_display, sym); if (!*keycode) { - g_message("Key '%s' does not exist on the display.", l); + g_warning("Key '%s' does not exist on the display.", l); goto translation_fail; } diff --git a/plugins/menu/client_menu.c b/plugins/menu/client_menu.c index 931ee79d..568c8b2d 100644 --- a/plugins/menu/client_menu.c +++ b/plugins/menu/client_menu.c @@ -1,14 +1,14 @@ -#include - +#include "kernel/debug.h" #include "kernel/menu.h" #include "kernel/screen.h" #include "kernel/client.h" #include "kernel/openbox.h" - #include "kernel/frame.h" #include "render/theme.h" +#include + static char *PLUGIN_NAME = "client_menu"; static ObMenu *send_to_menu; @@ -42,7 +42,7 @@ void client_send_to_update(ObMenu *self) if (it != NULL || i != screen_num_desktops) { menu_clear(self); - g_message("update"); + ob_debug("update\n"); for (i = 0; i < screen_num_desktops; ++i) { ObMenuEntry *e; Action *a = action_from_string("sendtodesktop"); @@ -58,7 +58,8 @@ void client_send_to_update(ObMenu *self) void client_menu_show(ObMenu *self, int x, int y, ObClient *client) { - guint i, newy, newx; + guint i; + gint newy, newx; Rect *a = NULL; g_assert(!self->invalid); diff --git a/plugins/placement/history.c b/plugins/placement/history.c index 27efa677..a7460b3d 100644 --- a/plugins/placement/history.c +++ b/plugins/placement/history.c @@ -1,3 +1,4 @@ +#include "kernel/debug.h" #include "kernel/openbox.h" #include "kernel/dispatch.h" #include "kernel/frame.h" @@ -145,7 +146,7 @@ static void save_history() for (it = history_list; it; it = g_slist_next(it)) { struct HistoryItem *hi = it->data; - g_message("adding %s", hi->name); + ob_debug("adding %s\n", hi->name); node = xmlNewChild(root, NULL, (const xmlChar*) "entry", NULL); xmlNewProp(node, (const xmlChar*) "name", (const xmlChar*) hi->name); xmlNewProp(node, (const xmlChar*) "class", (const xmlChar*) hi->class); diff --git a/render/color.c b/render/color.c index 3e9199c3..d16bbf0c 100644 --- a/render/color.c +++ b/render/color.c @@ -1,8 +1,9 @@ +#include "render.h" +#include "color.h" + #include #include #include -#include "render.h" -#include "color.h" void RrColorAllocateGC(RrColor *in) { @@ -75,10 +76,6 @@ void RrReduceDepth(const RrInstance *inst, RrPixel32 *data, XImage *im) if ((RrRedOffset(inst) != RrDefaultRedOffset) || (RrBlueOffset(inst) != RrDefaultBlueOffset) || (RrGreenOffset(inst) != RrDefaultGreenOffset)) { - g_message("CONVERSION %d->%d %d->%d %d->%d", - RrDefaultRedOffset, RrRedOffset(inst), - RrDefaultGreenOffset, RrGreenOffset(inst), - RrDefaultBlueOffset, RrBlueOffset(inst)); for (y = 0; y < im->height; y++) { for (x = 0; x < im->width; x++) { r = (data[x] >> RrDefaultRedOffset) & 0xFF; @@ -125,7 +122,7 @@ void RrReduceDepth(const RrInstance *inst, RrPixel32 *data, XImage *im) break; default: - g_message("your bit depth is currently unhandled\n"); + g_warning("your bit depth is currently unhandled\n"); } } @@ -143,8 +140,6 @@ static void swap_byte_order(XImage *im) { int x, y, di; - g_message("SWAPPING BYTE ORDER"); - di = 0; for (y = 0; y < im->height; ++y) { for (x = 0; x < im->height; ++x) { @@ -163,7 +158,7 @@ static void swap_byte_order(XImage *im) case 8: break; default: - g_message("your bit depth is currently unhandled\n"); + g_warning("your bit depth is currently unhandled"); } } di += im->bytes_per_line; @@ -224,7 +219,7 @@ void RrIncreaseDepth(const RrInstance *inst, RrPixel32 *data, XImage *im) } break; case 8: - g_message("this image bit depth is currently unhandled\n"); + g_warning("this image bit depth is currently unhandled"); break; case 1: for (y = 0; y < im->height; y++) { @@ -239,7 +234,7 @@ void RrIncreaseDepth(const RrInstance *inst, RrPixel32 *data, XImage *im) } break; default: - g_message("this image bit depth is currently unhandled\n"); + g_warning("this image bit depth is currently unhandled"); } } diff --git a/render/gradient.c b/render/gradient.c index 26ebbdc6..47f4850f 100644 --- a/render/gradient.c +++ b/render/gradient.c @@ -38,7 +38,7 @@ void RrRender(RrAppearance *a, int w, int h) gradient_pyramid(&a->surface, w, h); break; default: - g_message("unhandled gradient"); + g_assert_not_reached(); /* unhandled gradient */ return; } @@ -183,9 +183,6 @@ static void gradient_solid(RrAppearance *l, int w, int h) switch (sp->bevel) { case RR_BEVEL_1: - g_message("%lx %lx %lx", - sp->primary->pixel, - sp->bevel_dark->pixel, sp->bevel_light->pixel); XDrawLine(RrDisplay(l->inst), l->pixmap, sp->bevel_dark->gc, left, bottom, right, bottom); XDrawLine(RrDisplay(l->inst), l->pixmap, sp->bevel_dark->gc, diff --git a/render/instance.c b/render/instance.c index ad696655..26ea63c8 100644 --- a/render/instance.c +++ b/render/instance.c @@ -72,7 +72,6 @@ void RrPseudoColorSetup (RrInstance *inst) int tr, tg, tb, n, r, g, b, i, incolors, ii; unsigned long dev; int cpc, _ncolors; - g_message("Initializing PseudoColor RenderControl\n"); /* determine the number of colors and the bits-per-color */ inst->pseudo_bpc = 2; /* XXX THIS SHOULD BE A USER OPTION */ diff --git a/render/theme.c b/render/theme.c index a7da009b..4fc3d6a1 100644 --- a/render/theme.c +++ b/render/theme.c @@ -63,8 +63,9 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name) if (name) { db = loaddb(theme, name); if (db == NULL) { - g_warning("Failed to load the theme '%s'", name); - g_message("Falling back to the default: '%s'", DEFAULT_THEME); + g_warning("Failed to load the theme '%s'\n" + "Falling back to the default: '%s'", + name, DEFAULT_THEME); } else theme->name = g_path_get_basename(name); } diff --git a/tools/obconf/main.c b/tools/obconf/main.c index f0eb7306..645556c6 100644 --- a/tools/obconf/main.c +++ b/tools/obconf/main.c @@ -1,3 +1,4 @@ +#include "kernel/debug.h" #include "obconf.h" #include "plugins.h" #include "parser/parse.h" @@ -71,21 +72,21 @@ void on_quit_activate(GtkMenuItem *item, gpointer d) void on_applybutton_clicked(GtkButton *but, gpointer d) { - g_message("apply"); + ob_debug("apply\n"); } void on_revertbutton_clicked(GtkButton *but, gpointer d) { - g_message("revert"); + ob_debug("revert\n"); } void on_helpbutton_clicked(GtkButton *but, gpointer d) { - g_message("help"); + ob_debug("help\n"); } void on_sectiontree_row_activated(GtkTreeView *tree, GtkTreePath *path, GtkTreeViewColumn *col, gpointer p) { - g_message("activated"); + ob_debug("activated\n"); } -- 2.45.2