all repos — openbox @ a21840cbb7912c25abc1943c08d6980da7537a6c

openbox fork - make it a bit more like ryudo

make ob_debug use the g_log system, and make openbox log messages to..a log file ! this will help everyone since most people do not run openbox in a terminal..
Dana Jansens danakj@orodu.net
commit

a21840cbb7912c25abc1943c08d6980da7537a6c

parent

20b8fcfa33feeade5946bc7f3046705da5d164fe

M openbox/client.copenbox/client.c

@@ -264,7 +264,7 @@ }

XFree(wmhint); } - ob_debug("Managing window: 0x%lx\n", window); + ob_debug("Managing window: 0x%lx", window); map_time = event_get_server_time();

@@ -288,8 +288,8 @@

/* get all the stuff off the window */ client_get_all(self, TRUE); - ob_debug("Window type: %d\n", self->type); - ob_debug("Window group: 0x%x\n", self->group?self->group->leader:0); + ob_debug("Window type: %d", self->type); + ob_debug("Window group: 0x%x", self->group?self->group->leader:0); /* now we have all of the window's information so we can set this up. do this before creating the frame, so it can tell that we are still

@@ -356,7 +356,7 @@ monitor = screen_physical_area_monitor(screen_find_monitor(&place));

/* figure out placement for the window if the window is new */ if (ob_state() == OB_STATE_RUNNING) { - ob_debug("Positioned: %s @ %d %d\n", + ob_debug("Positioned: %s @ %d %d", (!self->positioned ? "no" : (self->positioned == PPosition ? "program specified" : (self->positioned == USPosition ? "user specified" :

@@ -364,7 +364,7 @@ (self->positioned == (PPosition | USPosition) ?

"program + user specified" : "BADNESS !?")))), place.x, place.y); - ob_debug("Sized: %s @ %d %d\n", + ob_debug("Sized: %s @ %d %d", (!self->sized ? "no" : (self->sized == PSize ? "program specified" : (self->sized == USSize ? "user specified" :

@@ -436,7 +436,7 @@ /* fit the window inside the area */

place.width = MIN(place.width, a->width); place.height = MIN(place.height, a->height); - ob_debug("setting window size to %dx%d\n", place.width, place.height); + ob_debug("setting window size to %dx%d", place.width, place.height); /* get the size of the client back */ place.width -= self->frame->size.left + self->frame->size.right;

@@ -446,11 +446,11 @@ g_free(a);

} ob_debug("placing window 0x%x at %d, %d with size %d x %d. " - "some restrictions may apply\n", + "some restrictions may apply", self->window, place.x, place.y, place.width, place.height); if (self->session) ob_debug(" but session requested %d, %d %d x %d instead, " - "overriding\n", + "overriding", self->session->x, self->session->y, self->session->w, self->session->h);

@@ -465,7 +465,7 @@

g_free(monitor); monitor = NULL; - ob_debug_type(OB_DEBUG_FOCUS, "Going to try activate new window? %s\n", + ob_debug_type(OB_DEBUG_FOCUS, "Going to try activate new window? %s", activate ? "yes" : "no"); if (activate) { gboolean raise = FALSE;

@@ -473,7 +473,7 @@

/* This is focus stealing prevention */ ob_debug_type(OB_DEBUG_FOCUS, "Want to focus new window 0x%x at time %u " - "launched at %u (last user interaction time %u)\n", + "launched at %u (last user interaction time %u)", self->window, map_time, launch_time, event_last_user_time);

@@ -483,7 +483,7 @@ raise = TRUE;

ob_debug_type(OB_DEBUG_FOCUS, "Not focusing the window because the user is inside " "an Openbox menu or is move/resizing a window and " - "we don't want to interrupt them\n"); + "we don't want to interrupt them"); } /* if it's on another desktop */

@@ -497,7 +497,7 @@ activate = FALSE;

raise = TRUE; ob_debug_type(OB_DEBUG_FOCUS, "Not focusing the window because its on another " - "desktop\n"); + "desktop"); } /* If something is focused, and it's not our relative... */ else if (focus_client && client_search_focus_tree_full(self) == NULL &&

@@ -514,14 +514,14 @@ {

activate = FALSE; ob_debug_type(OB_DEBUG_FOCUS, "Not focusing the window because the user is " - "working in another window\n"); + "working in another window"); } /* If its a transient (and its parents aren't focused) */ else if (client_has_parent(self)) { activate = FALSE; ob_debug_type(OB_DEBUG_FOCUS, "Not focusing the window because it is a " - "transient, and its relatives aren't focused\n"); + "transient, and its relatives aren't focused"); } /* Don't steal focus from globally active clients. I stole this idea from KWin. It seems nice.

@@ -532,7 +532,7 @@ {

activate = FALSE; ob_debug_type(OB_DEBUG_FOCUS, "Not focusing the window because a globally " - "active client has focus\n"); + "active client has focus"); } /* Don't move focus if it's not going to go to this window anyway */

@@ -541,7 +541,7 @@ activate = FALSE;

raise = TRUE; ob_debug_type(OB_DEBUG_FOCUS, "Not focusing the window because another window " - "would get the focus anyway\n"); + "would get the focus anyway"); } else if (!(self->desktop == screen_desktop || self->desktop == DESKTOP_ALL))

@@ -557,7 +557,7 @@

if (!activate) { ob_debug_type(OB_DEBUG_FOCUS, "Focus stealing prevention activated for %s at " - "time %u (last user interactioon time %u)\n", + "time %u (last user interactioon time %u)", self->title, map_time, event_last_user_time); /* if the client isn't focused, then hilite it so the user knows it is there */

@@ -623,7 +623,7 @@

/* free the ObAppSettings shallow copy */ g_free(settings); - ob_debug("Managed window 0x%lx plate 0x%x (%s)\n", + ob_debug("Managed window 0x%lx plate 0x%x (%s)", window, self->frame->window, self->class); return;

@@ -635,7 +635,7 @@ {

ObClient *self; ObAppSettings *settings; - ob_debug("Pretend-managing window: %lx\n", window); + ob_debug("Pretend-managing window: %lx", window); /* do this minimal stuff to figure out the client's decorations */

@@ -653,7 +653,7 @@ /* create the decoration frame for the client window and adjust its size */

self->frame = frame_new(self); frame_adjust_area(self->frame, FALSE, TRUE, TRUE); - ob_debug("gave extents left %d right %d top %d bottom %d\n", + ob_debug("gave extents left %d right %d top %d bottom %d", self->frame->size.left, self->frame->size.right, self->frame->size.top, self->frame->size.bottom);

@@ -675,7 +675,7 @@ guint j;

GSList *it; gulong ignore_start; - ob_debug("Unmanaging window: 0x%x plate 0x%x (%s) (%s)\n", + ob_debug("Unmanaging window: 0x%x plate 0x%x (%s) (%s)", self->window, self->frame->window, self->class, self->title ? self->title : "");

@@ -794,7 +794,7 @@

/* update the list hints */ client_set_list(); - ob_debug("Unmanaged window 0x%lx\n", self->window); + ob_debug("Unmanaged window 0x%lx", self->window); /* free all data allocated in the client struct */ g_slist_free(self->transients);

@@ -852,7 +852,7 @@ strlen(self->role), self->role, NULL))

match = FALSE; if (match) { - ob_debug("Window matching: %s\n", app->name); + ob_debug("Window matching: %s", app->name); /* copy the settings to our struct, overriding the existing settings if they are not defaults */

@@ -907,17 +907,17 @@ {

GList *it; ob_debug_type(OB_DEBUG_SM, - "Restore session for client %s\n", self->title); + "Restore session for client %s", self->title); if (!(it = session_state_find(self))) { ob_debug_type(OB_DEBUG_SM, - "Session data not found for client %s\n", self->title); + "Session data not found for client %s", self->title); return; } self->session = it->data; - ob_debug_type(OB_DEBUG_SM, "Session data loaded for client %s\n", + ob_debug_type(OB_DEBUG_SM, "Session data loaded for client %s", self->title); RECT_SET_POINT(self->area, self->session->x, self->session->y);

@@ -1170,7 +1170,7 @@ RECT_SET(self->area, wattrib.x, wattrib.y, wattrib.width, wattrib.height);

POINT_SET(self->root_pos, wattrib.x, wattrib.y); self->border_width = wattrib.border_width; - ob_debug("client area: %d %d %d %d bw %d\n", wattrib.x, wattrib.y, + ob_debug("client area: %d %d %d %d bw %d", wattrib.x, wattrib.y, wattrib.width, wattrib.height, wattrib.border_width); }

@@ -1183,7 +1183,7 @@ if (d >= screen_num_desktops && d != DESKTOP_ALL)

self->desktop = screen_num_desktops - 1; else self->desktop = d; - ob_debug("client requested desktop 0x%x\n", self->desktop); + ob_debug("client requested desktop 0x%x", self->desktop); } else { GSList *it; gboolean first = TRUE;

@@ -1206,7 +1206,7 @@ }

if (all != screen_num_desktops) { self->desktop = all; - ob_debug("client desktop set from parents: 0x%x\n", + ob_debug("client desktop set from parents: 0x%x", self->desktop); } /* try get from the startup-notification protocol */

@@ -1214,13 +1214,13 @@ else if (sn_get_desktop(self->startup_id, &self->desktop)) {

if (self->desktop >= screen_num_desktops && self->desktop != DESKTOP_ALL) self->desktop = screen_num_desktops - 1; - ob_debug("client desktop set from startup-notification: 0x%x\n", + ob_debug("client desktop set from startup-notification: 0x%x", self->desktop); } /* defaults to the current desktop */ else { self->desktop = screen_desktop; - ob_debug("client desktop set to the current desktop: %d\n", + ob_debug("client desktop set to the current desktop: %d", self->desktop); } }

@@ -1575,7 +1575,7 @@ void client_update_colormap(ObClient *self, Colormap colormap)

{ if (colormap == self->colormap) return; - ob_debug("Setting client %s colormap: 0x%x\n", self->title, colormap); + ob_debug("Setting client %s colormap: 0x%x", self->title, colormap); if (client_focused(self)) { screen_install_colormap(self, FALSE); /* uninstall old one */

@@ -1630,15 +1630,15 @@

if (size.flags & PResizeInc && size.width_inc && size.height_inc) SIZE_SET(self->size_inc, size.width_inc, size.height_inc); - ob_debug("Normal hints: min size (%d %d) max size (%d %d)\n " - "size inc (%d %d) base size (%d %d)\n", + ob_debug("Normal hints: min size (%d %d) max size (%d %d)", self->min_size.width, self->min_size.height, - self->max_size.width, self->max_size.height, + self->max_size.width, self->max_size.height); + ob_debug("size inc (%d %d) base size (%d %d)", self->size_inc.width, self->size_inc.height, self->base_size.width, self->base_size.height); } else - ob_debug("Normal hints: not set\n"); + ob_debug("Normal hints: not set"); } void client_setup_decor_and_functions(ObClient *self, gboolean reconfig)

@@ -2645,7 +2645,7 @@ do this before applying the states so they have the correct

pre-max/pre-fullscreen values */ client_try_configure(self, &x, &y, &w, &h, &l, &l, FALSE); - ob_debug("placed window 0x%x at %d, %d with size %d x %d\n", + ob_debug("placed window 0x%x at %d, %d with size %d x %d", self->window, x, y, w, h); /* save the area, and make it where it should be for the premax stuff */ oldarea = self->area;

@@ -3025,7 +3025,7 @@ event.xconfigure.display = obt_display;

event.xconfigure.event = self->window; event.xconfigure.window = self->window; - ob_debug("Sending ConfigureNotify to %s for %d,%d %dx%d\n", + ob_debug("Sending ConfigureNotify to %s for %d,%d %dx%d", self->title, self->root_pos.x, self->root_pos.y, w, h); /* root window real coords */

@@ -3094,7 +3094,7 @@ h = self->pre_fullscreen_area.height;

RECT_SET(self->pre_fullscreen_area, 0, 0, 0, 0); } - ob_debug("Window %s going fullscreen (%d)\n", + ob_debug("Window %s going fullscreen (%d)", self->title, self->fullscreen); client_setup_decor_and_functions(self, FALSE);

@@ -3120,7 +3120,7 @@ gboolean changed = FALSE;

if (self->iconic != iconic) { - ob_debug("%sconifying window: 0x%lx\n", (iconic ? "I" : "Uni"), + ob_debug("%sconifying window: 0x%lx", (iconic ? "I" : "Uni"), self->window); if (iconic) {

@@ -3294,7 +3294,7 @@ {

if (!self->client_machine && self->pid) { /* running on the local host */ if (!self->close_tried_term) { - ob_debug("killing window 0x%x with pid %lu, with SIGTERM\n", + ob_debug("killing window 0x%x with pid %lu, with SIGTERM", self->window, self->pid); kill(self->pid, SIGTERM); self->close_tried_term = TRUE;

@@ -3303,7 +3303,7 @@ /* show that we're trying to kill it */

client_update_title(self); } else { - ob_debug("killing window 0x%x with pid %lu, with SIGKILL\n", + ob_debug("killing window 0x%x with pid %lu, with SIGKILL", self->window, self->pid); kill(self->pid, SIGKILL); /* kill -9 */ }

@@ -3338,7 +3338,7 @@ GSList *it;

if (target != self->desktop && self->type != OB_CLIENT_TYPE_DESKTOP) { - ob_debug("Setting desktop %u\n", target+1); + ob_debug("Setting desktop %u", target+1); g_assert(target < screen_num_desktops || target == DESKTOP_ALL);

@@ -3640,12 +3640,12 @@ self = client_focus_target(self);

if (!client_can_focus(self)) { ob_debug_type(OB_DEBUG_FOCUS, - "Client %s can't be focused\n", self->title); + "Client %s can't be focused", self->title); return FALSE; } ob_debug_type(OB_DEBUG_FOCUS, - "Focusing client \"%s\" (0x%x) at time %u\n", + "Focusing client \"%s\" (0x%x) at time %u", self->title, self->window, event_curtime); /* if using focus_delay, stop the timer now so that focus doesn't

@@ -3687,7 +3687,7 @@ }

obt_display_ignore_errors(FALSE); - ob_debug_type(OB_DEBUG_FOCUS, "Error focusing? %d\n", + ob_debug_type(OB_DEBUG_FOCUS, "Error focusing? %d", obt_display_error_occured); return !obt_display_error_occured; }

@@ -4014,15 +4014,15 @@ default:

g_assert_not_reached(); } - ob_debug("my head %d size %d\n", my_head, my_size); - ob_debug("head %d tail %d deest %d\n", head, tail, *dest); + ob_debug("my head %d size %d", my_head, my_size); + ob_debug("head %d tail %d deest %d", head, tail, *dest); if (!skip_head) { - ob_debug("using near edge %d\n", head); + ob_debug("using near edge %d", head); *dest = head; *near_edge = TRUE; } else if (!skip_tail) { - ob_debug("using far edge %d\n", tail); + ob_debug("using far edge %d", tail); *dest = tail; *near_edge = FALSE; }

@@ -4087,7 +4087,7 @@ if (self->desktop != cur->desktop && cur->desktop != DESKTOP_ALL &&

cur->desktop != screen_desktop) continue; - ob_debug("trying window %s\n", cur->title); + ob_debug("trying window %s", cur->title); detect_edge(cur->frame->area, dir, my_head, my_size, my_edge_start, my_edge_size, dest, near_edge);

@@ -4208,10 +4208,10 @@ default:

g_assert_not_reached(); } - ob_debug("head %d dir %d\n", head, dir); + ob_debug("head %d dir %d", head, dir); client_find_edge_directional(self, dir, head, 1, e_start, e_size, &e, &near); - ob_debug("edge %d\n", e); + ob_debug("edge %d", e); *x = self->frame->area.x; *y = self->frame->area.y; *w = self->frame->area.width;
M openbox/debug.copenbox/debug.c

@@ -17,62 +17,145 @@ See the COPYING file for a copy of the GNU General Public License.

*/ #include "debug.h" +#include "gettext.h" +#include "obt/paths.h" #include <glib.h> #include <stdlib.h> #include <stdarg.h> #include <stdio.h> +#include <errno.h> -static gboolean show; +static gboolean enabled_types[OB_DEBUG_TYPE_NUM] = {FALSE}; +static FILE *log_file = NULL; +static guint rr_handler_id = 0; +static guint obt_handler_id = 0; +static guint ob_handler_id = 0; + +static void log_handler(const gchar *log_domain, GLogLevelFlags log_level, + const gchar *message, gpointer user_data); -void ob_debug_show_output(gboolean enable) +void ob_debug_startup(void) { - show = enable; + ObtPaths *p = obt_paths_new(); + gchar *dir = g_build_filename(obt_paths_cache_home(p), + "openbox", NULL); + + /* log messages to a log file! fancy, no? */ + if (!obt_paths_mkdir_path(dir, 0777)) + g_message(_("Unable to make directory '%s': %s"), + dir, g_strerror(errno)); + else { + gchar *name = g_build_filename(obt_paths_cache_home(p), + "openbox", "openbox.log", NULL); + log_file = fopen(name, "w"); + g_free(name); + } + + rr_handler_id = + g_log_set_handler("ObRender", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | + G_LOG_FLAG_RECURSION, log_handler, NULL); + obt_handler_id = + g_log_set_handler("Obt", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | + G_LOG_FLAG_RECURSION, log_handler, NULL); + ob_handler_id = + g_log_set_handler("Openbox", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | + G_LOG_FLAG_RECURSION, log_handler, NULL); + + g_free(dir); } -void ob_debug(const gchar *a, ...) +void ob_debug_shutdown(void) { - va_list vl; + g_log_remove_handler("ObRender", rr_handler_id); + g_log_remove_handler("Obt", obt_handler_id); + g_log_remove_handler("Openbox", ob_handler_id); - if (show) { - fprintf(stderr, "DEBUG: "); - va_start(vl, a); - vfprintf(stderr, a, vl); - va_end(vl); + if (log_file) { + fclose(log_file); + log_file = NULL; } } -static gboolean enabled_types[OB_DEBUG_TYPE_NUM] = {FALSE}; - void ob_debug_enable(ObDebugType type, gboolean enable) { g_assert(type < OB_DEBUG_TYPE_NUM); enabled_types[type] = enable; } -void ob_debug_type(ObDebugType type, const gchar *a, ...) +static inline void log_print(FILE *out, const gchar* log_domain, + const gchar *level, const gchar *message) +{ + fprintf(out, log_domain); + fprintf(out, "-"); + fprintf(out, level); + fprintf(out, ": "); + fprintf(out, message); + fprintf(out, "\n"); + fflush(out); +} + +static void log_handler(const gchar *log_domain, GLogLevelFlags log_level, + const gchar *message, gpointer data) +{ + FILE *out; + const gchar *level; + + switch (log_level & G_LOG_LEVEL_MASK) { + case G_LOG_LEVEL_DEBUG: level = "Debug"; out = stdout; break; + case G_LOG_LEVEL_INFO: level = "Info"; out = stdout; break; + case G_LOG_LEVEL_MESSAGE: level = "Message"; out = stdout; break; + case G_LOG_LEVEL_WARNING: level = "Warning"; out = stderr; break; + case G_LOG_LEVEL_CRITICAL: level = "Critical"; out = stderr; break; + case G_LOG_LEVEL_ERROR: level = "Error"; out = stderr; break; + default: g_assert_not_reached(); /* invalid level.. */ + } + + log_print(out, log_domain, level, message); + if (log_file) log_print(log_file, log_domain, level, message); +} + +static inline void log_argv(ObDebugType type, + const gchar *format, va_list args) { - va_list vl; + const gchar *prefix; + gchar *message; g_assert(type < OB_DEBUG_TYPE_NUM); + if (!enabled_types[type]) return; - if (show && enabled_types[type]) { - switch (type) { - case OB_DEBUG_FOCUS: - fprintf(stderr, "FOCUS: "); - break; - case OB_DEBUG_APP_BUGS: - fprintf(stderr, "APPLICATION BUG: "); - break; - case OB_DEBUG_SM: - fprintf(stderr, "SESSION: "); - break; - default: - g_assert_not_reached(); - } + switch (type) { + case OB_DEBUG_FOCUS: prefix = "(FOCUS) "; break; + case OB_DEBUG_APP_BUGS: prefix = "(APPLICATION BUG) "; break; + case OB_DEBUG_SM: prefix = "(SESSION) "; break; + default: prefix = NULL; break; + } - va_start(vl, a); - vfprintf(stderr, a, vl); - va_end(vl); + message = g_strdup_vprintf(format, args); + if (prefix) { + gchar *a = message; + message = g_strconcat(prefix, message, NULL); + g_free(a); } + + g_debug(message); + g_free(message); +} + +void ob_debug(const gchar *a, ...) +{ + va_list vl; + + va_start(vl, a); + log_argv(OB_DEBUG_NORMAL, a, vl); + va_end(vl); +} + +void ob_debug_type(ObDebugType type, const gchar *a, ...) +{ + va_list vl; + + va_start(vl, a); + log_argv(type, a, vl); + va_end(vl); }
M openbox/debug.hopenbox/debug.h

@@ -21,11 +21,13 @@ #define __ob__debug_h

#include <glib.h> -void ob_debug_show_output(gboolean enable); +void ob_debug_startup(); +void ob_debug_shutdown(); void ob_debug(const gchar *a, ...); typedef enum { + OB_DEBUG_NORMAL, OB_DEBUG_FOCUS, OB_DEBUG_APP_BUGS, OB_DEBUG_SM,
M openbox/dock.copenbox/dock.c

@@ -182,7 +182,7 @@ XSelectInput(obt_display, app->icon_win, DOCKAPP_EVENT_MASK);

dock_app_grab_button(app, TRUE); - ob_debug("Managed Dock App: 0x%lx (%s)\n", app->icon_win, app->class); + ob_debug("Managed Dock App: 0x%lx (%s)", app->icon_win, app->class); } void dock_remove_all(void)

@@ -206,7 +206,7 @@

dock->dock_apps = g_list_remove(dock->dock_apps, app); dock_configure(); - ob_debug("Unmanaged Dock App: 0x%lx (%s)\n", app->icon_win, app->class); + ob_debug("Unmanaged Dock App: 0x%lx (%s)", app->icon_win, app->class); g_free(app->name); g_free(app->class);
M openbox/event.copenbox/event.c

@@ -425,7 +425,7 @@ return;

g_assert(modestr); g_assert(detailstr); - ob_debug_type(OB_DEBUG_FOCUS, "Focus%s 0x%x mode=%s detail=%s\n", + ob_debug_type(OB_DEBUG_FOCUS, "Focus%s 0x%x mode=%s detail=%s", (e->xfocus.type == FocusIn ? "In" : "Out"), win, modestr, detailstr);

@@ -525,7 +525,7 @@ {

XEvent ce; ob_debug_type(OB_DEBUG_FOCUS, - "Focus went to root or pointer root/none\n"); + "Focus went to root or pointer root/none"); if (e->xfocus.detail == NotifyInferior || e->xfocus.detail == NotifyNonlinear)

@@ -551,7 +551,7 @@ NULL))

{ XPutBackEvent(obt_display, &ce); ob_debug_type(OB_DEBUG_FOCUS, - " but another FocusIn is coming\n"); + " but another FocusIn is coming"); } else { /* Focus has been reverted.

@@ -567,7 +567,7 @@ }

else if (!client) { ob_debug_type(OB_DEBUG_FOCUS, - "Focus went to a window that is already gone\n"); + "Focus went to a window that is already gone"); /* If you send focus to a window and then it disappears, you can get the FocusIn for it, after it is unmanaged.

@@ -598,12 +598,12 @@ XGetGeometry(obt_display, win, &root, &i,&i,&u,&u,&u,&u) &&

root != obt_root(ob_screen)) { ob_debug_type(OB_DEBUG_FOCUS, - "Focus went to another screen !\n"); + "Focus went to another screen !"); focus_left_screen = TRUE; } else ob_debug_type(OB_DEBUG_FOCUS, - "Focus went to a black hole !\n"); + "Focus went to a black hole !"); obt_display_ignore_errors(FALSE); /* nothing is focused */ focus_set_client(NULL);

@@ -615,7 +615,7 @@ if (ed.ignored) {

/* The FocusIn was ignored, this means it was on a window that isn't a client. */ ob_debug_type(OB_DEBUG_FOCUS, - "Focus went to an unmanaged window 0x%x !\n", + "Focus went to an unmanaged window 0x%x !", ce.xfocus.window); focus_fallback(TRUE, config_focus_under_mouse, TRUE, TRUE); }

@@ -643,7 +643,7 @@ client_manage(window);

else if (e->type == MappingNotify) { /* keyboard layout changes for modifier mapping changes. reload the modifier map, and rebind all the key bindings as appropriate */ - ob_debug("Kepboard map changed. Reloading keyboard bindings.\n"); + ob_debug("Kepboard map changed. Reloading keyboard bindings."); obt_keyboard_reload(); keyboard_rebind(); }

@@ -736,7 +736,7 @@ Atom msgtype;

switch(e->type) { case SelectionClear: - ob_debug("Another WM has requested to replace us. Exiting.\n"); + ob_debug("Another WM has requested to replace us. Exiting."); ob_exit_replace(); break;

@@ -751,7 +751,7 @@ event_curtime = e->xclient.data.l[1];

if (event_curtime == 0) ob_debug_type(OB_DEBUG_APP_BUGS, "_NET_CURRENT_DESKTOP message is missing " - "a timestamp\n"); + "a timestamp"); screen_set_desktop(d, TRUE); } } else if (msgtype == OBT_PROP_ATOM(NET_NUMBER_OF_DESKTOPS)) {

@@ -761,7 +761,7 @@ screen_set_num_desktops(d);

} else if (msgtype == OBT_PROP_ATOM(NET_SHOWING_DESKTOP)) { screen_show_desktop(e->xclient.data.l[0] != 0, NULL); } else if (msgtype == OBT_PROP_ATOM(OB_CONTROL)) { - ob_debug("OB_CONTROL: %d\n", e->xclient.data.l[0]); + ob_debug("OB_CONTROL: %d", e->xclient.data.l[0]); if (e->xclient.data.l[0] == 1) ob_reconfigure(); else if (e->xclient.data.l[0] == 2)

@@ -775,7 +775,7 @@ }

break; case PropertyNotify: if (e->xproperty.atom == OBT_PROP_ATOM(NET_DESKTOP_NAMES)) { - ob_debug("UPDATE DESKTOP NAMES\n"); + ob_debug("UPDATE DESKTOP NAMES"); screen_update_desktop_names(); } else if (e->xproperty.atom == OBT_PROP_ATOM(NET_DESKTOP_LAYOUT))

@@ -988,7 +988,7 @@ if (frame_iconify_animating(client->frame))

event_end_ignore_all_enters(event_start_ignore_all_enters()); ob_debug_type(OB_DEBUG_FOCUS, - "%sNotify mode %d detail %d on %lx\n", + "%sNotify mode %d detail %d on %lx", (e->type == EnterNotify ? "Enter" : "Leave"), e->xcrossing.mode, e->xcrossing.detail, (client?client->window:0));

@@ -1045,7 +1045,7 @@ is_enter_focus_event_ignored(e))

{ ob_debug_type(OB_DEBUG_FOCUS, "%sNotify mode %d detail %d serial %lu on %lx " - "IGNORED\n", + "IGNORED", (e->type == EnterNotify ? "Enter" : "Leave"), e->xcrossing.mode, e->xcrossing.detail,

@@ -1055,7 +1055,7 @@ }

else { ob_debug_type(OB_DEBUG_FOCUS, "%sNotify mode %d detail %d serial %lu on %lx, " - "focusing window\n", + "focusing window", (e->type == EnterNotify ? "Enter" : "Leave"), e->xcrossing.mode, e->xcrossing.detail,

@@ -1086,10 +1086,10 @@ /* get the current area */

RECT_TO_DIMS(client->area, x, y, w, h); ob_debug("ConfigureRequest for \"%s\" desktop %d wmstate %d " - "visibile %d\n" - " x %d y %d w %d h %d b %d\n", + "visibile %d", client->title, - screen_desktop, client->wmstate, client->frame->visible, + screen_desktop, client->wmstate, client->frame->visible); + ob_debug(" x %d y %d w %d h %d b %d", x, y, w, h, client->border_width); if (e->xconfigurerequest.value_mask & CWBorderWidth)

@@ -1169,7 +1169,7 @@ }

} ob_debug("ConfigureRequest x(%d) %d y(%d) %d w(%d) %d h(%d) %d " - "move %d resize %d\n", + "move %d resize %d", e->xconfigurerequest.value_mask & CWX, x, e->xconfigurerequest.value_mask & CWY, y, e->xconfigurerequest.value_mask & CWWidth, w,

@@ -1195,7 +1195,7 @@ {

ob_debug_type(OB_DEBUG_APP_BUGS, "Application %s is trying to move via " "ConfigureRequest to it's root window position " - "but it is not using StaticGravity\n", + "but it is not using StaticGravity", client->title); /* don't move it */ x = client->area.x;

@@ -1223,7 +1223,7 @@ client_gravity_resize_h(client, &y, client->area.height,h);

client_find_onscreen(client, &x, &y, w, h, FALSE); - ob_debug("Granting ConfigureRequest x %d y %d w %d h %d\n", + ob_debug("Granting ConfigureRequest x %d y %d w %d h %d", x, y, w, h); client_configure(client, x, y, w, h, FALSE, TRUE, TRUE); }

@@ -1231,7 +1231,7 @@ break;

} case UnmapNotify: ob_debug("UnmapNotify for window 0x%x eventwin 0x%x sendevent %d " - "ignores left %d\n", + "ignores left %d", client->window, e->xunmap.event, e->xunmap.from_configure, client->ignore_unmaps); if (client->ignore_unmaps) {

@@ -1241,7 +1241,7 @@ }

client_unmanage(client); break; case DestroyNotify: - ob_debug("DestroyNotify for window 0x%x\n", client->window); + ob_debug("DestroyNotify for window 0x%x", client->window); client_unmanage(client); break; case ReparentNotify:

@@ -1259,11 +1259,11 @@ /* we don't want the reparent event, put it back on the stack for the

X server to deal with after we unmanage the window */ XPutBackEvent(obt_display, e); - ob_debug("ReparentNotify for window 0x%x\n", client->window); + ob_debug("ReparentNotify for window 0x%x", client->window); client_unmanage(client); break; case MapRequest: - ob_debug("MapRequest for 0x%lx\n", client->window); + ob_debug("MapRequest for 0x%lx", client->window); if (!client->iconic) break; /* this normally doesn't happen, but if it does, we don't want it! it can happen now when the window is on

@@ -1313,7 +1313,7 @@ } else if (msgtype == OBT_PROP_ATOM(NET_WM_STATE)) {

gulong ignore_start; /* can't compress these */ - ob_debug("net_wm_state %s %ld %ld for 0x%lx\n", + ob_debug("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"),

@@ -1328,10 +1328,10 @@ e->xclient.data.l[1], e->xclient.data.l[2]);

if (!config_focus_under_mouse) event_end_ignore_all_enters(ignore_start); } else if (msgtype == OBT_PROP_ATOM(NET_CLOSE_WINDOW)) { - ob_debug("net_close_window for 0x%lx\n", client->window); + ob_debug("net_close_window for 0x%lx", client->window); client_close(client); } else if (msgtype == OBT_PROP_ATOM(NET_ACTIVE_WINDOW)) { - ob_debug("net_active_window for 0x%lx source=%s\n", + ob_debug("net_active_window for 0x%lx source=%s", client->window, (e->xclient.data.l[0] == 0 ? "unknown" : (e->xclient.data.l[0] == 1 ? "application" :

@@ -1345,16 +1345,16 @@ event_curtime = e->xclient.data.l[1];*/

if (e->xclient.data.l[1] == 0) ob_debug_type(OB_DEBUG_APP_BUGS, "_NET_ACTIVE_WINDOW message for window %s is" - " missing a timestamp\n", client->title); + " missing a timestamp", client->title); } else ob_debug_type(OB_DEBUG_APP_BUGS, "_NET_ACTIVE_WINDOW message for window %s is " - "missing source indication\n"); + "missing source indication"); client_activate(client, FALSE, TRUE, TRUE, (e->xclient.data.l[0] == 0 || e->xclient.data.l[0] == 2)); } else if (msgtype == OBT_PROP_ATOM(NET_WM_MOVERESIZE)) { - ob_debug("net_wm_moveresize for 0x%lx direction %d\n", + ob_debug("net_wm_moveresize for 0x%lx direction %d", client->window, e->xclient.data.l[2]); if ((Atom)e->xclient.data.l[2] == OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_TOPLEFT) ||

@@ -1427,7 +1427,7 @@ }

else h = client->area.height; - ob_debug("MOVERESIZE x %d %d y %d %d (gravity %d)\n", + ob_debug("MOVERESIZE x %d %d y %d %d (gravity %d)", e->xclient.data.l[0] & 1 << 8, x, e->xclient.data.l[0] & 1 << 9, y, client->gravity);

@@ -1441,7 +1441,7 @@ } else if (msgtype == OBT_PROP_ATOM(NET_RESTACK_WINDOW)) {

if (e->xclient.data.l[0] != 2) { ob_debug_type(OB_DEBUG_APP_BUGS, "_NET_RESTACK_WINDOW sent for window %s with " - "invalid source indication %ld\n", + "invalid source indication %ld", client->title, e->xclient.data.l[0]); } else { ObClient *sibling = NULL;

@@ -1455,7 +1455,7 @@ }

if (sibling == NULL) ob_debug_type(OB_DEBUG_APP_BUGS, "_NET_RESTACK_WINDOW sent for window %s " - "with invalid sibling 0x%x\n", + "with invalid sibling 0x%x", client->title, e->xclient.data.l[1]); } if (e->xclient.data.l[2] == Below ||

@@ -1480,7 +1480,7 @@ client_reconfigure(client, TRUE);

} else ob_debug_type(OB_DEBUG_APP_BUGS, "_NET_RESTACK_WINDOW sent for window %s " - "with invalid detail %d\n", + "with invalid detail %d", client->title, e->xclient.data.l[2]); } }

@@ -1523,7 +1523,7 @@ }

msgtype = e->xproperty.atom; if (msgtype == XA_WM_NORMAL_HINTS) { - ob_debug("Update NORMAL hints\n"); + ob_debug("Update NORMAL hints"); client_update_normal_hints(client); /* normal hints can make a window non-resizable */ client_setup_decor_and_functions(client, FALSE);

@@ -1945,7 +1945,7 @@ r->start = start;

r->end = end; ignore_serials = g_slist_prepend(ignore_serials, r); - ob_debug_type(OB_DEBUG_FOCUS, "ignoring enters from %lu until %lu\n", + ob_debug_type(OB_DEBUG_FOCUS, "ignoring enters from %lu until %lu", r->start, r->end); /* increment the serial so we don't ignore events we weren't meant to */

@@ -1992,19 +1992,19 @@ void event_cancel_all_key_grabs(void)

{ if (actions_interactive_act_running()) { actions_interactive_cancel_act(); - ob_debug("KILLED interactive action\n"); + ob_debug("KILLED interactive action"); } else if (menu_frame_visible) { menu_frame_hide_all(); - ob_debug("KILLED open menus\n"); + ob_debug("KILLED open menus"); } else if (moveresize_in_progress) { moveresize_end(TRUE); - ob_debug("KILLED interactive moveresize\n"); + ob_debug("KILLED interactive moveresize"); } else if (grab_on_keyboard()) { ungrab_keyboard(); - ob_debug("KILLED active grab on keyboard\n"); + ob_debug("KILLED active grab on keyboard"); } else ungrab_passive_key();
M openbox/focus.copenbox/focus.c

@@ -66,7 +66,7 @@ {

Window active; ob_debug_type(OB_DEBUG_FOCUS, - "focus_set_client 0x%lx\n", client ? client->window : 0); + "focus_set_client 0x%lx", client ? client->window : 0); if (focus_client == client) return;

@@ -103,18 +103,18 @@ {

GList *it; ObClient *c; - ob_debug_type(OB_DEBUG_FOCUS, "trying pointer stuff\n"); + ob_debug_type(OB_DEBUG_FOCUS, "trying pointer stuff"); if (allow_pointer && config_focus_follow) if ((c = client_under_pointer()) && (allow_refocus || client_focus_target(c) != old) && (client_normal(c) && client_focus(c))) { - ob_debug_type(OB_DEBUG_FOCUS, "found in pointer stuff\n"); + ob_debug_type(OB_DEBUG_FOCUS, "found in pointer stuff"); return c; } - ob_debug_type(OB_DEBUG_FOCUS, "trying the focus order\n"); + ob_debug_type(OB_DEBUG_FOCUS, "trying the focus order"); for (it = focus_order; it; it = g_list_next(it)) { c = it->data; /* fallback focus to a window if:

@@ -130,12 +130,12 @@ !c->shaded &&

(allow_refocus || client_focus_target(c) != old) && client_focus(c)) { - ob_debug_type(OB_DEBUG_FOCUS, "found in focus order\n"); + ob_debug_type(OB_DEBUG_FOCUS, "found in focus order"); return c; } } - ob_debug_type(OB_DEBUG_FOCUS, "trying a desktop window\n"); + ob_debug_type(OB_DEBUG_FOCUS, "trying a desktop window"); for (it = focus_order; it; it = g_list_next(it)) { c = it->data; /* fallback focus to a window if:

@@ -149,7 +149,7 @@ if (focus_valid_target(c, TRUE, FALSE, FALSE, FALSE, TRUE) &&

(allow_refocus || client_focus_target(c) != old) && client_focus(c)) { - ob_debug_type(OB_DEBUG_FOCUS, "found a desktop window\n"); + ob_debug_type(OB_DEBUG_FOCUS, "found a desktop window"); return c; } }
M openbox/openbox.copenbox/openbox.c

@@ -116,16 +116,14 @@ gchar *program_name;

state = OB_STATE_STARTING; + ob_debug_startup(); + /* initialize the locale */ if (!setlocale(LC_ALL, "")) g_message("Couldn't set locale from environment."); bindtextdomain(PACKAGE_NAME, LOCALEDIR); bind_textdomain_codeset(PACKAGE_NAME, "UTF-8"); textdomain(PACKAGE_NAME); - - if (chdir(g_get_home_dir()) == -1) - g_message(_("Unable to change to home directory '%s': %s"), - g_get_home_dir(), g_strerror(errno)); /* parse the command line args, which can change the argv[0] */ parse_args(&argc, argv);

@@ -420,6 +418,8 @@ g_free(ob_sm_save_file);

g_free(ob_sm_id); g_free(program_name); + ob_debug_shutdown(); + return exitcode; }

@@ -427,11 +427,11 @@ static void signal_handler(gint signal, gpointer data)

{ switch (signal) { case SIGUSR1: - ob_debug("Caught signal %d. Restarting.\n", signal); + ob_debug("Caught signal %d. Restarting.", signal); ob_restart(); break; case SIGUSR2: - ob_debug("Caught signal %d. Reconfiguring.\n", signal); + ob_debug("Caught signal %d. Reconfiguring.", signal); ob_reconfigure(); break; case SIGCHLD:

@@ -439,7 +439,7 @@ /* reap children */

while (waitpid(-1, NULL, WNOHANG) > 0); break; default: - ob_debug("Caught signal %d. Exiting.\n", signal); + ob_debug("Caught signal %d. Exiting.", signal); /* TERM and INT return a 0 code */ ob_exit(!(signal == SIGTERM || signal == SIGINT)); }

@@ -473,6 +473,7 @@ g_print(_("\nDebugging options:\n"));

g_print(_(" --sync Run in synchronous mode\n")); g_print(_(" --debug Display debugging output\n")); g_print(_(" --debug-focus Display debugging output for focus handling\n")); + g_print(_(" --debug-session Display debugging output for session managment\n")); g_print(_(" --debug-xinerama Split the display into fake xinerama screens\n")); g_print(_("\nPlease report bugs at %s\n"), PACKAGE_BUGREPORT); }

@@ -519,15 +520,18 @@ else if (!strcmp(argv[i], "--sync")) {

xsync = TRUE; } else if (!strcmp(argv[i], "--debug")) { - ob_debug_show_output(TRUE); - ob_debug_enable(OB_DEBUG_SM, TRUE); + ob_debug_enable(OB_DEBUG_NORMAL, TRUE); ob_debug_enable(OB_DEBUG_APP_BUGS, TRUE); } else if (!strcmp(argv[i], "--debug-focus")) { - ob_debug_show_output(TRUE); - ob_debug_enable(OB_DEBUG_SM, TRUE); + ob_debug_enable(OB_DEBUG_NORMAL, TRUE); ob_debug_enable(OB_DEBUG_APP_BUGS, TRUE); ob_debug_enable(OB_DEBUG_FOCUS, TRUE); + } + else if (!strcmp(argv[i], "--debug-session")) { + ob_debug_enable(OB_DEBUG_NORMAL, TRUE); + ob_debug_enable(OB_DEBUG_APP_BUGS, TRUE); + ob_debug_enable(OB_DEBUG_SM, TRUE); } else if (!strcmp(argv[i], "--debug-xinerama")) { ob_debug_xinerama = TRUE;

@@ -549,7 +553,7 @@ else {

ob_sm_save_file = g_strdup(argv[i+1]); remove_args(argc, argv, i, 2); --i; /* this arg was removed so go back */ - ob_debug_type(OB_DEBUG_SM, "--sm-save-file %s\n", + ob_debug_type(OB_DEBUG_SM, "--sm-save-file %s", ob_sm_save_file); } }

@@ -561,7 +565,7 @@ else {

ob_sm_id = g_strdup(argv[i+1]); remove_args(argc, argv, i, 2); --i; /* this arg was removed so go back */ - ob_debug_type(OB_DEBUG_SM, "--sm-client-id %s\n", ob_sm_id); + ob_debug_type(OB_DEBUG_SM, "--sm-client-id %s", ob_sm_id); } } else if (!strcmp(argv[i], "--sm-disable")) {
M openbox/ping.copenbox/ping.c

@@ -99,7 +99,7 @@ {

ObPingTarget *t; if ((t = g_hash_table_lookup(ping_ids, &id))) { - /*ob_debug("-PONG: '%s' (id %u)\n", t->client->title, t->id);*/ + /*ob_debug("-PONG: '%s' (id %u)", t->client->title, t->id);*/ if (t->waiting > PING_TIMEOUT_WARN) { /* we had notified that they weren't responding, so now we need to notify that they are again */

@@ -108,7 +108,7 @@ }

t->waiting = 0; /* not waiting for a reply anymore */ } else - ob_debug("Got PONG with id %u but not waiting for one\n", id); + ob_debug("Got PONG with id %u but not waiting for one", id); } static gboolean find_client(gpointer key, gpointer value, gpointer client)

@@ -131,7 +131,7 @@ if (++ping_next_id == 0) ++ping_next_id; /* skip 0 on wraparound */

g_hash_table_insert(ping_ids, &t->id, t); } - /*ob_debug("+PING: '%s' (id %u)\n", t->client->title, t->id);*/ + /*ob_debug("+PING: '%s' (id %u)", t->client->title, t->id);*/ OBT_PROP_MSG_TO(t->client->window, t->client->window, WM_PROTOCOLS, OBT_PROP_ATOM(NET_WM_PING), t->id, t->client->window, 0, 0, NoEventMask);
M openbox/place.copenbox/place.c

@@ -76,7 +76,7 @@

/* try direct parent first */ if ((p = client_direct_parent(c))) { add_choice(choice, client_monitor(p)); - ob_debug("placement adding choice %d for parent\n", + ob_debug("placement adding choice %d for parent", client_monitor(p)); }

@@ -92,7 +92,7 @@ (itc->desktop == c->desktop ||

itc->desktop == DESKTOP_ALL || c->desktop == DESKTOP_ALL)) { add_choice(choice, client_monitor(it->data)); - ob_debug("placement adding choice %d for group sibling\n", + ob_debug("placement adding choice %d for group sibling", client_monitor(it->data)); } }

@@ -103,7 +103,7 @@ ObClient *itc = it->data;

if (itc != c) { add_choice(choice, client_monitor(it->data)); ob_debug("placement adding choice %d for group sibling on " - "another desktop\n", client_monitor(it->data)); + "another desktop", client_monitor(it->data)); } } }

@@ -113,7 +113,7 @@ if (focus_client && client_normal(focus_client) &&

config_place_monitor != OB_PLACE_MONITOR_MOUSE) { add_choice(choice, client_monitor(focus_client)); - ob_debug("placement adding choice %d for normal focused window\n", + ob_debug("placement adding choice %d for normal focused window", client_monitor(focus_client)); }

@@ -125,7 +125,7 @@ gboolean contain = RECT_CONTAINS(*monitor, px, py);

g_free(monitor); if (contain) { add_choice(choice, i); - ob_debug("placement adding choice %d for mouse pointer\n", i); + ob_debug("placement adding choice %d for mouse pointer", i); break; } }
M openbox/screen.copenbox/screen.c

@@ -662,7 +662,7 @@ obt_main_loop_timeout_remove(ob_main_loop, last_desktop_func);

obt_main_loop_timeout_add(ob_main_loop, REMEMBER_LAST_DESKTOP_TIME, last_desktop_func, NULL, NULL, NULL); - ob_debug("Moving to desktop %d\n", num+1); + ob_debug("Moving to desktop %d", num+1); /* ignore enter events caused by the move */ ignore_start = event_start_ignore_all_enters();

@@ -719,7 +719,7 @@ /* don't move direct children, they'll be moved with their

parent - which will have to be on the same desktop */ !client_direct_parent(c)) { - ob_debug("moving window %s\n", c->title); + ob_debug("moving window %s", c->title); client_set_desktop(c, c->desktop+1, FALSE, TRUE); } }

@@ -760,7 +760,7 @@ /* don't move direct children, they'll be moved with their

parent - which will have to be on the same desktop */ !client_direct_parent(c)) { - ob_debug("moving window %s\n", c->title); + ob_debug("moving window %s", c->title); client_set_desktop(c, c->desktop - 1, TRUE, TRUE); } /* raise all the windows that are on the current desktop which

@@ -770,7 +770,7 @@ screen_desktop == rmdesktop) &&

(d == DESKTOP_ALL || d == screen_desktop)) { stacking_raise(CLIENT_AS_WINDOW(c)); - ob_debug("raising window %s\n", c->title); + ob_debug("raising window %s", c->title); } } }

@@ -778,7 +778,7 @@

/* fallback focus like we're changing desktops */ if (screen_desktop < screen_num_desktops - 1) { screen_fallback_focus(); - ob_debug("fake desktop change\n"); + ob_debug("fake desktop change"); } screen_set_num_desktops(screen_num_desktops-1);
M openbox/session.copenbox/session.c

@@ -110,7 +110,7 @@ }

if (ob_sm_save_file != NULL) { if (ob_sm_restore) { - ob_debug_type(OB_DEBUG_SM, "Loading from session file %s\n", + ob_debug_type(OB_DEBUG_SM, "Loading from session file %s", ob_sm_save_file); session_load_file(ob_sm_save_file); }

@@ -177,7 +177,7 @@ cb.shutdown_cancelled.client_data = NULL;

/* connect to the server */ oldid = ob_sm_id; - ob_debug_type(OB_DEBUG_SM, "Connecting to SM with id: %s\n", + ob_debug_type(OB_DEBUG_SM, "Connecting to SM with id: %s", oldid ? oldid : "(null)"); sm_conn = SmcOpenConnection(NULL, NULL, 1, 0, SmcSaveYourselfProcMask |

@@ -187,9 +187,9 @@ SmcShutdownCancelledProcMask,

&cb, oldid, &ob_sm_id, SM_ERR_LEN-1, sm_err); g_free(oldid); - ob_debug_type(OB_DEBUG_SM, "Connected to SM with id: %s\n", ob_sm_id); + ob_debug_type(OB_DEBUG_SM, "Connected to SM with id: %s", ob_sm_id); if (sm_conn == NULL) - ob_debug("Failed to connect to session manager: %s\n", sm_err); + ob_debug("Failed to connect to session manager: %s", sm_err); return sm_conn != NULL; }

@@ -206,7 +206,7 @@ .num_vals = 1,

.vals = &vals }; SmProp *list = &prop; - ob_debug_type(OB_DEBUG_SM, "Setting program: %s\n", sm_argv[0]); + ob_debug_type(OB_DEBUG_SM, "Setting program: %s", sm_argv[0]); SmcSetProperties(sm_conn, 1, &list); g_free(prop.name); g_free(prop.type);

@@ -227,7 +227,7 @@ .num_vals = 1,

.vals = &vals }; SmProp *list = &prop; - ob_debug_type(OB_DEBUG_SM, "Setting user: %s\n", user); + ob_debug_type(OB_DEBUG_SM, "Setting user: %s", user); SmcSetProperties(sm_conn, 1, &list); g_free(prop.name); g_free(prop.type);

@@ -249,7 +249,7 @@ .num_vals = 1,

.vals = &vals }; SmProp *list = &prop; - ob_debug_type(OB_DEBUG_SM, "Setting restart: %d\n", restart); + ob_debug_type(OB_DEBUG_SM, "Setting restart: %d", restart); SmcSetProperties(sm_conn, 1, &list); g_free(prop.name); g_free(prop.type);

@@ -270,7 +270,7 @@ .num_vals = 1,

.vals = &vals }; SmProp *list = &prop; - ob_debug_type(OB_DEBUG_SM, "Setting pid: %s\n", pid); + ob_debug_type(OB_DEBUG_SM, "Setting pid: %s", pid); SmcSetProperties(sm_conn, 1, &list); g_free(prop.name); g_free(prop.type);

@@ -293,7 +293,7 @@ .num_vals = 1,

.vals = &vals }; SmProp *list = &prop; - ob_debug_type(OB_DEBUG_SM, "Setting priority: %d\n", priority); + ob_debug_type(OB_DEBUG_SM, "Setting priority: %d", priority); SmcSetProperties(sm_conn, 1, &list); g_free(prop.name); g_free(prop.type);

@@ -312,11 +312,11 @@ .vals = vals

}; SmProp *list = &prop; - ob_debug_type(OB_DEBUG_SM, "Setting clone command: (%d)\n", sm_argc); + ob_debug_type(OB_DEBUG_SM, "Setting clone command: (%d)", sm_argc); for (i = 0; i < sm_argc; ++i) { vals[i].value = sm_argv[i]; vals[i].length = strlen(sm_argv[i]) + 1; - ob_debug_type(OB_DEBUG_SM, " %s\n", vals[i].value); + ob_debug_type(OB_DEBUG_SM, " %s", vals[i].value); } SmcSetProperties(sm_conn, 1, &list);

@@ -338,26 +338,26 @@ .vals = vals

}; SmProp *list = &prop; - ob_debug_type(OB_DEBUG_SM, "Setting restart command: (%d)\n", sm_argc+4); + ob_debug_type(OB_DEBUG_SM, "Setting restart command: (%d)", sm_argc+4); for (i = 0; i < sm_argc; ++i) { vals[i].value = sm_argv[i]; vals[i].length = strlen(sm_argv[i]) + 1; - ob_debug_type(OB_DEBUG_SM, " %s\n", vals[i].value); + ob_debug_type(OB_DEBUG_SM, " %s", vals[i].value); } vals[i].value = g_strdup("--sm-client-id"); vals[i].length = strlen("--sm-client-id") + 1; vals[i+1].value = ob_sm_id; vals[i+1].length = strlen(ob_sm_id) + 1; - ob_debug_type(OB_DEBUG_SM, " %s\n", vals[i].value); - ob_debug_type(OB_DEBUG_SM, " %s\n", vals[i+1].value); + ob_debug_type(OB_DEBUG_SM, " %s", vals[i].value); + ob_debug_type(OB_DEBUG_SM, " %s", vals[i+1].value); vals[i+2].value = g_strdup("--sm-save-file"); vals[i+2].length = strlen("--sm-save-file") + 1; vals[i+3].value = ob_sm_save_file; vals[i+3].length = strlen(ob_sm_save_file) + 1; - ob_debug_type(OB_DEBUG_SM, " %s\n", vals[i+2].value); - ob_debug_type(OB_DEBUG_SM, " %s\n", vals[i+3].value); + ob_debug_type(OB_DEBUG_SM, " %s", vals[i+2].value); + ob_debug_type(OB_DEBUG_SM, " %s", vals[i+3].value); SmcSetProperties(sm_conn, 1, &list); g_free(prop.name);

@@ -385,9 +385,9 @@ gboolean success;

ObSMSaveData *savedata = data; /* save the current state */ - ob_debug_type(OB_DEBUG_SM, "Session save phase 2 requested\n"); + ob_debug_type(OB_DEBUG_SM, "Session save phase 2 requested"); ob_debug_type(OB_DEBUG_SM, - " Saving session to file '%s'\n", ob_sm_save_file); + " Saving session to file '%s'", ob_sm_save_file); if (savedata == NULL) savedata = sm_save_get_data(); success = session_save_to_file(savedata);

@@ -396,7 +396,7 @@

/* tell the session manager how to restore this state */ if (success) session_setup_restart_command(); - ob_debug_type(OB_DEBUG_SM, "Saving is done (success = %d)\n", success); + ob_debug_type(OB_DEBUG_SM, "Saving is done (success = %d)", success); SmcSaveYourselfDone(conn, success); }

@@ -407,10 +407,10 @@ {

ObSMSaveData *savedata = NULL; gchar *vendor; - ob_debug_type(OB_DEBUG_SM, "Session save requested\n"); + ob_debug_type(OB_DEBUG_SM, "Session save requested"); vendor = SmcVendor(sm_conn); - ob_debug_type(OB_DEBUG_SM, "Session manager's vendor: %s\n", vendor); + ob_debug_type(OB_DEBUG_SM, "Session manager's vendor: %s", vendor); if (!strcmp(vendor, "KDE")) { /* ksmserver guarantees that phase 1 will complete before allowing any

@@ -421,7 +421,7 @@ }

free(vendor); if (!SmcRequestSaveYourselfPhase2(conn, sm_save_yourself_2, savedata)) { - ob_debug_type(OB_DEBUG_SM, "Requst for phase 2 failed\n"); + ob_debug_type(OB_DEBUG_SM, "Requst for phase 2 failed"); g_free(savedata); SmcSaveYourselfDone(conn, FALSE); }

@@ -429,18 +429,18 @@ }

static void sm_die(SmcConn conn, SmPointer data) { - ob_debug_type(OB_DEBUG_SM, "Die requested\n"); + ob_debug_type(OB_DEBUG_SM, "Die requested"); ob_exit(0); } static void sm_save_complete(SmcConn conn, SmPointer data) { - ob_debug_type(OB_DEBUG_SM, "Save complete\n"); + ob_debug_type(OB_DEBUG_SM, "Save complete"); } static void sm_shutdown_cancelled(SmcConn conn, SmPointer data) { - ob_debug_type(OB_DEBUG_SM, "Shutdown cancelled\n"); + ob_debug_type(OB_DEBUG_SM, "Shutdown cancelled"); } static gboolean session_save_to_file(const ObSMSaveData *savedata)

@@ -498,18 +498,18 @@ continue;

if (!c->sm_client_id) { ob_debug_type(OB_DEBUG_SM, "Client %s does not have a " - "session id set\n", + "session id set", c->title); if (!c->wm_command) { ob_debug_type(OB_DEBUG_SM, "Client %s does not have an " "oldskool wm_command set either. We won't " - "be saving its data\n", + "be saving its data", c->title); continue; } } - ob_debug_type(OB_DEBUG_SM, "Saving state for client %s\n", + ob_debug_type(OB_DEBUG_SM, "Saving state for client %s", c->title); prex = c->area.x;

@@ -608,20 +608,20 @@ }

static gboolean session_state_cmp(ObSessionState *s, ObClient *c) { - ob_debug_type(OB_DEBUG_SM, "Comparing client against saved state: \n"); - ob_debug_type(OB_DEBUG_SM, " client id: %s \n", c->sm_client_id); - ob_debug_type(OB_DEBUG_SM, " client name: %s \n", c->name); - ob_debug_type(OB_DEBUG_SM, " client class: %s \n", c->class); - ob_debug_type(OB_DEBUG_SM, " client role: %s \n", c->role); - ob_debug_type(OB_DEBUG_SM, " client type: %d \n", c->type); - ob_debug_type(OB_DEBUG_SM, " client command: %s \n", + ob_debug_type(OB_DEBUG_SM, "Comparing client against saved state: "); + ob_debug_type(OB_DEBUG_SM, " client id: %s ", c->sm_client_id); + ob_debug_type(OB_DEBUG_SM, " client name: %s ", c->name); + ob_debug_type(OB_DEBUG_SM, " client class: %s ", c->class); + ob_debug_type(OB_DEBUG_SM, " client role: %s ", c->role); + ob_debug_type(OB_DEBUG_SM, " client type: %d ", c->type); + ob_debug_type(OB_DEBUG_SM, " client command: %s ", c->wm_command ? c->wm_command : "(null)"); - ob_debug_type(OB_DEBUG_SM, " state id: %s \n", s->id); - ob_debug_type(OB_DEBUG_SM, " state name: %s \n", s->name); - ob_debug_type(OB_DEBUG_SM, " state class: %s \n", s->class); - ob_debug_type(OB_DEBUG_SM, " state role: %s \n", s->role); - ob_debug_type(OB_DEBUG_SM, " state type: %d \n", s->type); - ob_debug_type(OB_DEBUG_SM, " state command: %s \n", + ob_debug_type(OB_DEBUG_SM, " state id: %s ", s->id); + ob_debug_type(OB_DEBUG_SM, " state name: %s ", s->name); + ob_debug_type(OB_DEBUG_SM, " state class: %s ", s->class); + ob_debug_type(OB_DEBUG_SM, " state role: %s ", s->role); + ob_debug_type(OB_DEBUG_SM, " state type: %d ", s->type); + ob_debug_type(OB_DEBUG_SM, " state command: %s ", s->command ? s->command : "(null)"); if ((c->sm_client_id && s->id && !strcmp(c->sm_client_id, s->id)) ||
M openbox/stacking.copenbox/stacking.c

@@ -624,21 +624,20 @@ sibling->desktop != DESKTOP_ALL) ||

sibling->iconic)) { ob_debug("Setting restack sibling to NULL, they are not on the same " - "desktop or it is iconified\n"); + "desktop or it is iconified"); sibling = NULL; } switch (detail) { case Below: - ob_debug("Restack request Below for client %s sibling %s\n", + ob_debug("Restack request Below for client %s sibling %s", client->title, sibling ? sibling->title : "(all)"); /* just lower it */ stacking_lower(CLIENT_AS_WINDOW(client)); ret = TRUE; break; case BottomIf: - ob_debug("Restack request BottomIf for client %s sibling " - "%s\n", + ob_debug("Restack request BottomIf for client %s sibling %s", client->title, sibling ? sibling->title : "(all)"); /* if this client occludes sibling (or anything if NULL), then lower it to the bottom */

@@ -648,13 +647,13 @@ ret = TRUE;

} break; case Above: - ob_debug("Restack request Above for client %s sibling %s\n", + ob_debug("Restack request Above for client %s sibling %s", client->title, sibling ? sibling->title : "(all)"); stacking_raise(CLIENT_AS_WINDOW(client)); ret = TRUE; break; case TopIf: - ob_debug("Restack request TopIf for client %s sibling %s\n", + ob_debug("Restack request TopIf for client %s sibling %s", client->title, sibling ? sibling->title : "(all)"); if (stacking_occluded(client, sibling)) { stacking_raise(CLIENT_AS_WINDOW(client));

@@ -662,8 +661,7 @@ ret = TRUE;

} break; case Opposite: - ob_debug("Restack request Opposite for client %s sibling " - "%s\n", + ob_debug("Restack request Opposite for client %s sibling %s", client->title, sibling ? sibling->title : "(all)"); if (stacking_occluded(client, sibling)) { stacking_raise(CLIENT_AS_WINDOW(client));
M po/POTFILES.inpo/POTFILES.in

@@ -6,6 +6,7 @@ openbox/client_list_combined_menu.c

openbox/client_list_menu.c openbox/client_menu.c openbox/config.c +openbox/debug.c openbox/keyboard.c openbox/menu.c openbox/mouse.c