change many LOG/printf messages to use DLOG

next
Michael Stapelberg 2011-01-07 20:58:58 +01:00
parent 186d2c7bfa
commit 228b5c51ff
6 changed files with 56 additions and 56 deletions

View File

@ -36,10 +36,10 @@ Con *con_new(Con *parent) {
new->type = CT_CON;
new->border_style = config.default_border;
static int cnt = 0;
LOG("opening window %d\n", cnt);
DLOG("opening window %d\n", cnt);
/* TODO: remove window coloring after test-phase */
LOG("color %s\n", colors[cnt]);
DLOG("color %s\n", colors[cnt]);
new->name = strdup(colors[cnt]);
//uint32_t cp = get_colorpixel(colors[cnt]);
cnt++;
@ -290,7 +290,7 @@ Con *con_get_fullscreen_con(Con *con) {
*/
bool con_is_floating(Con *con) {
assert(con != NULL);
LOG("checking if con %p is floating\n", con);
DLOG("checking if con %p is floating\n", con);
return (con->floating >= FLOATING_AUTO_ON);
}
@ -347,8 +347,8 @@ Con *con_by_frame_id(xcb_window_t frame) {
Con *con_for_window(i3Window *window, Match **store_match) {
Con *con;
Match *match;
LOG("searching con for window %p\n", window);
LOG("class == %s\n", window->class_class);
DLOG("searching con for window %p\n", window);
DLOG("class == %s\n", window->class_class);
TAILQ_FOREACH(con, &all_cons, all_cons)
TAILQ_FOREACH(match, &(con->swallow_head), matches) {
@ -406,7 +406,7 @@ void con_fix_percent(Con *con, int action) {
*/
void con_toggle_fullscreen(Con *con) {
Con *workspace, *fullscreen;
LOG("toggling fullscreen for %p / %s\n", con, con->name);
DLOG("toggling fullscreen for %p / %s\n", con, con->name);
if (con->fullscreen_mode == CF_NONE) {
/* 1: check if there already is a fullscreen con */
workspace = con_get_workspace(con);
@ -422,7 +422,7 @@ void con_toggle_fullscreen(Con *con) {
/* 1: disable fullscreen */
con->fullscreen_mode = CF_NONE;
}
LOG("mode now: %d\n", con->fullscreen_mode);
DLOG("mode now: %d\n", con->fullscreen_mode);
/* update _NET_WM_STATE if this container has a window */
/* TODO: when a window is assigned to a container which is already
@ -551,7 +551,7 @@ Con *con_get_next(Con *con, char way, orientation_t orientation) {
/* 1: get the first parent with the same orientation */
Con *cur = con;
while (con_orientation(cur->parent) != orientation) {
LOG("need to go one level further up\n");
DLOG("need to go one level further up\n");
if (cur->parent->type == CT_WORKSPACE) {
LOG("that's a workspace, we can't go further up\n");
return NULL;

View File

@ -619,7 +619,7 @@ int handle_expose_event(void *data, xcb_connection_t *conn, xcb_expose_event_t *
x_draw_decoration(parent);
TAILQ_FOREACH(con, &(parent->nodes_head), nodes) {
LOG("expose for con %p / %s\n", con, con->name);
DLOG("expose for con %p / %s\n", con, con->name);
if (con->window)
x_draw_decoration(con);
}
@ -627,7 +627,7 @@ int handle_expose_event(void *data, xcb_connection_t *conn, xcb_expose_event_t *
/* We also need to render the decorations of other Cons nearby the Con
* itself to not get overlapping decorations */
TAILQ_FOREACH(con, &(parent->parent->nodes_head), nodes) {
LOG("expose for con %p / %s\n", con, con->name);
DLOG("expose for con %p / %s\n", con, con->name);
if (con->window)
x_draw_decoration(con);
}

View File

@ -50,12 +50,12 @@ void manage_existing_windows(xcb_window_t root) {
*
*/
void restore_geometry() {
LOG("Restoring geometry\n");
DLOG("Restoring geometry\n");
Con *con;
TAILQ_FOREACH(con, &all_cons, all_cons)
if (con->window) {
printf("placing window at %d %d\n", con->rect.x, con->rect.y);
DLOG("placing window at %d %d\n", con->rect.x, con->rect.y);
xcb_reparent_window(conn, con->window->id, root,
con->rect.x, con->rect.y);
}
@ -75,7 +75,7 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
xcb_get_geometry_reply_t *geom;
xcb_get_window_attributes_reply_t *attr = 0;
printf("---> looking at window 0x%08x\n", window);
DLOG("---> looking at window 0x%08x\n", window);
xcb_get_property_cookie_t wm_type_cookie, strut_cookie, state_cookie,
utf8_title_cookie, title_cookie,
@ -96,33 +96,33 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
/* Check if the window is mapped (it could be not mapped when intializing and
calling manage_window() for every window) */
if ((attr = xcb_get_window_attributes_reply(conn, cookie, 0)) == NULL) {
LOG("Could not get attributes\n");
DLOG("Could not get attributes\n");
return;
}
if (needs_to_be_mapped && attr->map_state != XCB_MAP_STATE_VIEWABLE) {
LOG("map_state unviewable\n");
DLOG("map_state unviewable\n");
goto out;
}
/* Dont manage clients with the override_redirect flag */
LOG("override_redirect is %d\n", attr->override_redirect);
DLOG("override_redirect is %d\n", attr->override_redirect);
if (attr->override_redirect)
goto out;
/* Check if the window is already managed */
if (con_by_window_id(window) != NULL) {
LOG("already managed (by con %p)\n", con_by_window_id(window));
DLOG("already managed (by con %p)\n", con_by_window_id(window));
goto out;
}
/* Get the initial geometry (position, size, …) */
if ((geom = xcb_get_geometry_reply(conn, geomc, 0)) == NULL) {
LOG("could not get geometry\n");
DLOG("could not get geometry\n");
goto out;
}
LOG("reparenting!\n");
DLOG("reparenting!\n");
uint32_t mask = 0;
uint32_t values[1];
@ -172,7 +172,7 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
if (match != NULL && match->insert_where == M_ACTIVE) {
/* We need to go down the focus stack starting from nc */
while (TAILQ_FIRST(&(nc->focus_head)) != TAILQ_END(&(nc->focus_head))) {
printf("walking down one step...\n");
DLOG("walking down one step...\n");
nc = TAILQ_FIRST(&(nc->focus_head));
}
/* We need to open a new con */
@ -215,7 +215,7 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
* are bigger than our minimal useful size (75x50). */
nc->rect.width = max(geom->width, 75);
nc->rect.height = max(geom->height, 50);
LOG("geometry = %d x %d\n", nc->rect.width, nc->rect.height);
DLOG("geometry = %d x %d\n", nc->rect.width, nc->rect.height);
floating_enable(nc, false);
}

View File

@ -17,10 +17,10 @@ static bool show_debug_borders = false;
*
*/
void render_con(Con *con, bool render_fullscreen) {
printf("currently rendering node %p / %s / layout %d\n",
DLOG("currently rendering node %p / %s / layout %d\n",
con, con->name, con->layout);
int children = con_num_children(con);
printf("children: %d, orientation = %d\n", children, con->orientation);
DLOG("children: %d, orientation = %d\n", children, con->orientation);
/* Copy container rect, subtract container border */
/* This is the actually usable space inside this container for clients */
@ -97,7 +97,7 @@ void render_con(Con *con, bool render_fullscreen) {
/* Check for fullscreen nodes */
Con *fullscreen = con_get_fullscreen_con(con);
if (fullscreen) {
LOG("got fs node: %p\n", fullscreen);
DLOG("got fs node: %p\n", fullscreen);
fullscreen->rect = rect;
x_raise_con(fullscreen);
render_con(fullscreen, true);
@ -147,7 +147,7 @@ void render_con(Con *con, bool render_fullscreen) {
/* first we have the decoration, if this is a leaf node */
if (con_is_leaf(child) && child->border_style == BS_NORMAL) {
printf("that child is a leaf node, subtracting deco\n");
DLOG("that child is a leaf node, subtracting deco\n");
/* TODO: make a function for relative coords? */
child->deco_rect.x = child->rect.x - con->rect.x;
child->deco_rect.y = child->rect.y - con->rect.y;
@ -162,7 +162,7 @@ void render_con(Con *con, bool render_fullscreen) {
/* stacked layout */
else if (con->layout == L_STACKED) {
printf("stacked con\n");
DLOG("stacked con\n");
child->rect.x = x;
child->rect.y = y;
child->rect.width = rect.width;
@ -179,7 +179,7 @@ void render_con(Con *con, bool render_fullscreen) {
/* tabbed layout */
else if (con->layout == L_TABBED) {
printf("tabbed con\n");
DLOG("tabbed con\n");
child->rect.x = x;
child->rect.y = y;
child->rect.width = rect.width;
@ -196,9 +196,9 @@ void render_con(Con *con, bool render_fullscreen) {
}
}
printf("child at (%d, %d) with (%d x %d)\n",
DLOG("child at (%d, %d) with (%d x %d)\n",
child->rect.x, child->rect.y, child->rect.width, child->rect.height);
printf("x now %d, y now %d\n", x, y);
DLOG("x now %d, y now %d\n", x, y);
x_raise_con(child);
render_con(child, false);
i++;
@ -208,7 +208,7 @@ void render_con(Con *con, bool render_fullscreen) {
if (con->layout == L_STACKED || con->layout == L_TABBED) {
Con *foc = TAILQ_FIRST(&(con->focus_head));
if (foc != TAILQ_END(&(con->focus_head))) {
LOG("con %p is stacking, raising %p\n", con, foc);
DLOG("con %p is stacking, raising %p\n", con, foc);
x_raise_con(foc);
/* by rendering the stacked container again, we handle the case
* that we have a non-leaf-container inside the stack. */
@ -217,11 +217,11 @@ void render_con(Con *con, bool render_fullscreen) {
}
TAILQ_FOREACH(child, &(con->floating_head), floating_windows) {
LOG("render floating:\n");
LOG("floating child at (%d,%d) with %d x %d\n", child->rect.x, child->rect.y, child->rect.width, child->rect.height);
DLOG("render floating:\n");
DLOG("floating child at (%d,%d) with %d x %d\n", child->rect.x, child->rect.y, child->rect.width, child->rect.height);
x_raise_con(child);
render_con(child, false);
}
printf("-- level up\n");
DLOG("-- level up\n");
}

View File

@ -326,7 +326,7 @@ void tree_render() {
if (croot == NULL)
return;
printf("-- BEGIN RENDERING --\n");
DLOG("-- BEGIN RENDERING --\n");
/* Reset map state for all nodes in tree */
/* TODO: a nicer method to walk all nodes would be good, maybe? */
mark_unmapped(croot);
@ -335,11 +335,11 @@ void tree_render() {
/* We start rendering at an output */
Con *output;
TAILQ_FOREACH(output, &(croot->nodes_head), nodes) {
printf("output %p / %s\n", output, output->name);
DLOG("output %p / %s\n", output, output->name);
render_con(output, false);
}
x_push_changes(croot);
printf("-- END RENDERING --\n");
DLOG("-- END RENDERING --\n");
}
/*

40
src/x.c
View File

@ -93,7 +93,7 @@ void x_con_init(Con *con) {
state->initial = true;
CIRCLEQ_INSERT_HEAD(&state_head, state, state);
CIRCLEQ_INSERT_HEAD(&old_state_head, state, old_state);
LOG("adding new state for window id 0x%08x\n", state->id);
DLOG("adding new state for window id 0x%08x\n", state->id);
}
/*
@ -110,7 +110,7 @@ void x_reinit(Con *con) {
return;
}
LOG("resetting state %p to initial\n", state);
DLOG("resetting state %p to initial\n", state);
state->initial = true;
state->child_mapped = false;
memset(&(state->window_rect), 0, sizeof(Rect));
@ -153,7 +153,7 @@ void x_move_win(Con *src, Con *dest) {
memset(&zero, 0, sizeof(Rect));
if (memcmp(&(state_dest->window_rect), &(zero), sizeof(Rect)) == 0) {
memcpy(&(state_dest->window_rect), &(state_src->window_rect), sizeof(Rect));
LOG("COPYING RECT\n");
DLOG("COPYING RECT\n");
}
}
@ -382,7 +382,7 @@ static void x_push_node(Con *con) {
con_state *state;
Rect rect = con->rect;
LOG("Pushing changes for node %p / %s\n", con, con->name);
DLOG("Pushing changes for node %p / %s\n", con, con->name);
state = state_for_frame(con->frame);
if (state->name != NULL) {
@ -414,7 +414,7 @@ static void x_push_node(Con *con) {
/* reparent the child window (when the window was moved due to a sticky
* container) */
if (state->need_reparent && con->window != NULL) {
LOG("Reparenting child window\n");
DLOG("Reparenting child window\n");
/* Temporarily set the event masks to XCB_NONE so that we wont get
* UnmapNotify events (otherwise the handler would close the container).
@ -441,7 +441,7 @@ static void x_push_node(Con *con) {
bool fake_notify = false;
/* set new position if rect changed */
if (memcmp(&(state->rect), &rect, sizeof(Rect)) != 0) {
LOG("setting rect (%d, %d, %d, %d)\n", rect.x, rect.y, rect.width, rect.height);
DLOG("setting rect (%d, %d, %d, %d)\n", rect.x, rect.y, rect.width, rect.height);
xcb_set_window_rect(conn, con->frame, rect);
memcpy(&(state->rect), &rect, sizeof(Rect));
fake_notify = true;
@ -450,7 +450,7 @@ static void x_push_node(Con *con) {
/* dito, but for child windows */
if (con->window != NULL &&
memcmp(&(state->window_rect), &(con->window_rect), sizeof(Rect)) != 0) {
LOG("setting window rect (%d, %d, %d, %d)\n",
DLOG("setting window rect (%d, %d, %d, %d)\n",
con->window_rect.x, con->window_rect.y, con->window_rect.width, con->window_rect.height);
xcb_set_window_rect(conn, con->window->id, con->window_rect);
memcpy(&(state->window_rect), &(con->window_rect), sizeof(Rect));
@ -475,21 +475,21 @@ static void x_push_node(Con *con) {
if (!state->child_mapped && con->window != NULL) {
cookie = xcb_map_window(conn, con->window->id);
LOG("mapping child window (serial %d)\n", cookie.sequence);
DLOG("mapping child window (serial %d)\n", cookie.sequence);
/* Ignore enter_notifies which are generated when mapping */
add_ignore_event(cookie.sequence);
state->child_mapped = true;
}
cookie = xcb_map_window(conn, con->frame);
LOG("mapping container (serial %d)\n", cookie.sequence);
DLOG("mapping container (serial %d)\n", cookie.sequence);
/* Ignore enter_notifies which are generated when mapping */
add_ignore_event(cookie.sequence);
state->mapped = con->mapped;
}
if (fake_notify) {
LOG("Sending fake configure notify\n");
DLOG("Sending fake configure notify\n");
fake_absolute_configure_notify(con);
}
@ -517,7 +517,7 @@ static void x_push_node_unmaps(Con *con) {
Con *current;
con_state *state;
LOG("Pushing changes (with unmaps) for node %p / %s\n", con, con->name);
DLOG("Pushing changes (with unmaps) for node %p / %s\n", con, con->name);
state = state_for_frame(con->frame);
/* map/unmap if map state changed, also ensure that the child window
@ -534,7 +534,7 @@ static void x_push_node_unmaps(Con *con) {
}
cookie = xcb_unmap_window(conn, con->frame);
LOG("unmapping container (serial %d)\n", cookie.sequence);
DLOG("unmapping container (serial %d)\n", cookie.sequence);
/* we need to increase ignore_unmap for this container (if it
* contains a window) and for every window "under" this one which
* contains a window */
@ -563,20 +563,20 @@ static void x_push_node_unmaps(Con *con) {
void x_push_changes(Con *con) {
con_state *state;
LOG("\n\n PUSHING CHANGES\n\n");
DLOG("\n\n PUSHING CHANGES\n\n");
x_push_node(con);
LOG("-- PUSHING WINDOW STACK --\n");
DLOG("-- PUSHING WINDOW STACK --\n");
bool order_changed = false;
/* X11 correctly represents the stack if we push it from bottom to top */
CIRCLEQ_FOREACH_REVERSE(state, &state_head, state) {
LOG("stack: 0x%08x\n", state->id);
DLOG("stack: 0x%08x\n", state->id);
con_state *prev = CIRCLEQ_PREV(state, state);
con_state *old_prev = CIRCLEQ_PREV(state, old_state);
if (prev != old_prev)
order_changed = true;
if ((state->initial || order_changed) && prev != CIRCLEQ_END(&state_head)) {
LOG("Stacking 0x%08x above 0x%08x\n", prev->id, state->id);
DLOG("Stacking 0x%08x above 0x%08x\n", prev->id, state->id);
uint32_t mask = 0;
mask |= XCB_CONFIG_WINDOW_SIBLING;
mask |= XCB_CONFIG_WINDOW_STACK_MODE;
@ -596,14 +596,14 @@ void x_push_changes(Con *con) {
if (!focused->mapped) {
DLOG("Not updating focus (to %p / %s), focused window is not mapped.\n", focused, focused->name);
} else {
LOG("Updating focus (focused: %p / %s)\n", focused, focused->name);
DLOG("Updating focus (focused: %p / %s)\n", focused, focused->name);
xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, to_focus, XCB_CURRENT_TIME);
focused_id = to_focus;
}
}
xcb_flush(conn);
LOG("\n\n ENDING CHANGES\n\n");
DLOG("\n\n ENDING CHANGES\n\n");
x_push_node_unmaps(con);
@ -613,7 +613,7 @@ void x_push_changes(Con *con) {
CIRCLEQ_INSERT_TAIL(&old_state_head, state, old_state);
}
CIRCLEQ_FOREACH(state, &old_state_head, old_state) {
LOG("old stack: 0x%08x\n", state->id);
DLOG("old stack: 0x%08x\n", state->id);
}
}
@ -624,7 +624,7 @@ void x_push_changes(Con *con) {
*/
void x_raise_con(Con *con) {
con_state *state;
LOG("raising in new stack: %p / %s\n", con, con->name);
DLOG("raising in new stack: %p / %s\n", con, con->name);
state = state_for_frame(con->frame);
CIRCLEQ_REMOVE(&state_head, state, state);