From 10d3281b0f483892e5ff234ee716c9553497750c Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sun, 23 Oct 2011 00:15:13 +0100 Subject: [PATCH] remove/shorten a lot of debugging messages Some of them are useless nowadays, others very unlikely to be a problem. Those which might still be interesting somewhen in the future are just commented out. --- src/assignments.c | 2 +- src/con.c | 5 ++--- src/ewmh.c | 1 - src/handlers.c | 10 +++++----- src/manage.c | 6 +----- src/match.c | 7 +------ src/render.c | 29 +++-------------------------- src/window.c | 12 ++++++------ src/x.c | 34 +++++++++------------------------- 9 files changed, 28 insertions(+), 78 deletions(-) diff --git a/src/assignments.c b/src/assignments.c index 1aeacce6..1a586807 100644 --- a/src/assignments.c +++ b/src/assignments.c @@ -15,7 +15,7 @@ * */ void run_assignments(i3Window *window) { - DLOG("Checking assignments...\n"); + DLOG("Checking if any assignments matches this window\n"); /* Check if any assignments match */ Assignment *current; diff --git a/src/con.c b/src/con.c index b126ec06..12efdf58 100644 --- a/src/con.c +++ b/src/con.c @@ -193,7 +193,6 @@ void con_focus(Con *con) { con->urgent = false; workspace_update_urgent_flag(con_get_workspace(con)); } - DLOG("con_focus done = %p\n", con); } /* @@ -404,8 +403,8 @@ Con *con_by_frame_id(xcb_window_t frame) { Con *con_for_window(Con *con, i3Window *window, Match **store_match) { Con *child; Match *match; - DLOG("searching con for window %p starting at con %p\n", window, con); - DLOG("class == %s\n", window->class_class); + //DLOG("searching con for window %p starting at con %p\n", window, con); + //DLOG("class == %s\n", window->class_class); TAILQ_FOREACH(child, &(con->nodes_head), nodes) { TAILQ_FOREACH(match, &(child->swallow_head), matches) { diff --git a/src/ewmh.c b/src/ewmh.c index 68fac63a..85daa433 100644 --- a/src/ewmh.c +++ b/src/ewmh.c @@ -112,7 +112,6 @@ void ewmh_update_workarea() { * */ void ewmh_update_client_list_stacking(xcb_window_t *stack, int num_windows) { - DLOG("Updating _NET_CLIENT_LIST_STACKING\n"); xcb_change_property( conn, XCB_PROP_MODE_REPLACE, diff --git a/src/handlers.c b/src/handlers.c index 01a720af..0695f2d0 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -684,7 +684,7 @@ static void handle_client_message(xcb_client_message_event_t *event) { xcb_flush(conn); free(reply); } else { - ELOG("unhandled clientmessage\n"); + DLOG("unhandled clientmessage\n"); return; } } @@ -1017,7 +1017,7 @@ static void property_notify(uint8_t state, xcb_window_t window, xcb_atom_t atom) } if (handler == NULL) { - DLOG("Unhandled property notify for atom %d (0x%08x)\n", atom, atom); + //DLOG("Unhandled property notify for atom %d (0x%08x)\n", atom, atom); return; } @@ -1098,15 +1098,15 @@ void handle_event(int type, xcb_generic_event_t *event) { handle_focus_in((xcb_focus_in_event_t*)event); break; - case XCB_PROPERTY_NOTIFY: - DLOG("Property notify\n"); + case XCB_PROPERTY_NOTIFY: { xcb_property_notify_event_t *e = (xcb_property_notify_event_t*)event; last_timestamp = e->time; property_notify(e->state, e->window, e->atom); break; + } default: - DLOG("Unhandled event of type %d\n", type); + //DLOG("Unhandled event of type %d\n", type); break; } } diff --git a/src/manage.c b/src/manage.c index b0d3f2f7..df4dc11e 100644 --- a/src/manage.c +++ b/src/manage.c @@ -77,8 +77,6 @@ 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 = NULL; - 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, class_cookie, leader_cookie, transient_cookie, @@ -100,13 +98,11 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki } if (needs_to_be_mapped && attr->map_state != XCB_MAP_STATE_VIEWABLE) { - DLOG("map_state unviewable\n"); FREE_GEOMETRY(); goto out; } /* Don’t manage clients with the override_redirect flag */ - DLOG("override_redirect is %d\n", attr->override_redirect); if (attr->override_redirect) { FREE_GEOMETRY(); goto out; @@ -148,7 +144,7 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki startup_id_cookie = GET_PROPERTY(A__NET_STARTUP_ID, 512); /* TODO: also get wm_normal_hints here. implement after we got rid of xcb-event */ - DLOG("reparenting!\n"); + DLOG("Managing window 0x%08x\n", window); i3Window *cwindow = scalloc(sizeof(i3Window)); cwindow->id = window; diff --git a/src/match.c b/src/match.c index 25644c60..c2773acc 100644 --- a/src/match.c +++ b/src/match.c @@ -73,14 +73,13 @@ void match_copy(Match *dest, Match *src) { * */ bool match_matches_window(Match *match, i3Window *window) { - LOG("checking window %d (%s)\n", window->id, window->class_class); + LOG("Checking window 0x%08x (class %s)\n", window->id, window->class_class); if (match->class != NULL) { if (window->class_class != NULL && regex_matches(match->class, window->class_class)) { LOG("window class matches (%s)\n", window->class_class); } else { - LOG("window class does not match\n"); return false; } } @@ -90,7 +89,6 @@ bool match_matches_window(Match *match, i3Window *window) { regex_matches(match->instance, window->class_instance)) { LOG("window instance matches (%s)\n", window->class_instance); } else { - LOG("window instance does not match\n"); return false; } } @@ -109,7 +107,6 @@ bool match_matches_window(Match *match, i3Window *window) { regex_matches(match->title, window->name_json)) { LOG("title matches (%s)\n", window->name_json); } else { - LOG("title does not match\n"); return false; } } @@ -119,13 +116,11 @@ bool match_matches_window(Match *match, i3Window *window) { regex_matches(match->role, window->role)) { LOG("window_role matches (%s)\n", window->role); } else { - LOG("window_role does not match\n"); return false; } } if (match->dock != -1) { - LOG("match->dock = %d, window->dock = %d\n", match->dock, window->dock); if ((window->dock == W_DOCK_TOP && match->dock == M_DOCK_TOP) || (window->dock == W_DOCK_BOTTOM && match->dock == M_DOCK_BOTTOM) || ((window->dock == W_DOCK_TOP || window->dock == W_DOCK_BOTTOM) && diff --git a/src/render.c b/src/render.c index e1a56d9a..63c3b4d9 100644 --- a/src/render.c +++ b/src/render.c @@ -25,7 +25,6 @@ static void render_l_output(Con *con) { int x = con->rect.x; int y = con->rect.y; int height = con->rect.height; - DLOG("Available height: %d\n", height); /* Find the content container and ensure that there is exactly one. Also * check for any non-CT_DOCKAREA clients. */ @@ -51,7 +50,6 @@ static void render_l_output(Con *con) { Con *ws = con_get_fullscreen_con(content, CF_OUTPUT); Con *fullscreen = con_get_fullscreen_con(ws, CF_OUTPUT); if (fullscreen) { - DLOG("got fs node: %p\n", fullscreen); fullscreen->rect = con->rect; x_raise_con(fullscreen); render_con(fullscreen, true); @@ -67,13 +65,10 @@ static void render_l_output(Con *con) { child->rect.height = 0; TAILQ_FOREACH(dockchild, &(child->nodes_head), nodes) child->rect.height += dockchild->geometry.height; - DLOG("This dockarea's height: %d\n", child->rect.height); height -= child->rect.height; } - DLOG("Remaining: %d\n", height); - /* Second pass: Set the widths/heights */ TAILQ_FOREACH(child, &(con->nodes_head), nodes) { if (child->type == CT_CON) { @@ -96,7 +91,6 @@ static void render_l_output(Con *con) { DLOG("child at (%d, %d) with (%d x %d)\n", child->rect.x, child->rect.y, child->rect.width, child->rect.height); - DLOG("x now %d, y now %d\n", x, y); x_raise_con(child); render_con(child, false); } @@ -111,10 +105,10 @@ static void render_l_output(Con *con) { * */ void render_con(Con *con, bool render_fullscreen) { - DLOG("currently rendering node %p / %s / layout %d\n", - con, con->name, con->layout); int children = con_num_children(con); - DLOG("children: %d, orientation = %d\n", children, con->orientation); + DLOG("Rendering %snode %p / %s / layout %d / children %d / orient %d\n", + (render_fullscreen ? "fullscreen " : ""), con, con->name, con->layout, + children, con->orientation); /* Copy container rect, subtract container border */ /* This is the actually usable space inside this container for clients */ @@ -145,16 +139,13 @@ void render_con(Con *con, bool render_fullscreen) { if (!render_fullscreen) *inset = rect_add(*inset, con_border_style_rect(con)); - DLOG("Starting with inset = (%d, %d) %d x %d\n", inset->x, inset->y, inset->width, inset->height); /* Obey x11 border */ - DLOG("X11 border: %d\n", con->border_width); inset->width -= (2 * con->border_width); inset->height -= (2 * con->border_width); /* Obey the aspect ratio, if any */ if (con->proportional_height != 0 && con->proportional_width != 0) { - DLOG("proportional height = %d, width = %d\n", con->proportional_height, con->proportional_width); double new_height = inset->height + 1; int new_width = inset->width; @@ -170,7 +161,6 @@ void render_con(Con *con, bool render_fullscreen) { inset->height = new_height; inset->width = new_width; - DLOG("new_height = %f, new_width = %d\n", new_height, new_width); } if (con->height_increment > 1) { @@ -196,7 +186,6 @@ void render_con(Con *con, bool render_fullscreen) { fullscreen = con_get_fullscreen_con(con, (con->type == CT_ROOT ? CF_GLOBAL : CF_OUTPUT)); } if (fullscreen) { - DLOG("got fs node: %p\n", fullscreen); fullscreen->rect = rect; x_raise_con(fullscreen); render_con(fullscreen, true); @@ -232,7 +221,6 @@ void render_con(Con *con, bool render_fullscreen) { if (con->layout == L_OUTPUT) { render_l_output(con); } else if (con->type == CT_ROOT) { - DLOG("Root node, rendering outputs\n"); Con *child; TAILQ_FOREACH(child, &(con->nodes_head), nodes) { render_con(child, false); @@ -262,7 +250,6 @@ 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) { - 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; @@ -277,7 +264,6 @@ void render_con(Con *con, bool render_fullscreen) { /* stacked layout */ else if (con->layout == L_STACKED) { - DLOG("stacked con\n"); child->rect.x = x; child->rect.y = y; child->rect.width = rect.width; @@ -296,7 +282,6 @@ void render_con(Con *con, bool render_fullscreen) { /* tabbed layout */ else if (con->layout == L_TABBED) { - DLOG("tabbed con\n"); child->rect.x = x; child->rect.y = y; child->rect.width = rect.width; @@ -315,7 +300,6 @@ void render_con(Con *con, bool render_fullscreen) { /* dockarea layout */ else if (con->layout == L_DOCKAREA) { - DLOG("dockarea con\n"); child->rect.x = x; child->rect.y = y; child->rect.width = rect.width; @@ -330,7 +314,6 @@ void render_con(Con *con, bool render_fullscreen) { DLOG("child at (%d, %d) with (%d x %d)\n", child->rect.x, child->rect.y, child->rect.width, child->rect.height); - DLOG("x now %d, y now %d\n", x, y); x_raise_con(child); render_con(child, false); i++; @@ -338,12 +321,9 @@ void render_con(Con *con, bool render_fullscreen) { /* in a stacking or tabbed container, we ensure the focused client is raised */ if (con->layout == L_STACKED || con->layout == L_TABBED) { - DLOG("stacked/tabbed, raising focused reverse\n"); TAILQ_FOREACH_REVERSE(child, &(con->focus_head), focus_head, focused) x_raise_con(child); - DLOG("done\n"); if ((child = TAILQ_FIRST(&(con->focus_head)))) { - DLOG("con %p is stacking, raising %p\n", con, child); /* By rendering the stacked container again, we handle the case * that we have a non-leaf-container inside the stack. In that * case, the children of the non-leaf-container need to be raised @@ -362,11 +342,8 @@ void render_con(Con *con, bool render_fullscreen) { Con *child; TAILQ_FOREACH(child, &(con->floating_head), floating_windows) { - 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); } - - DLOG("-- level up\n"); } diff --git a/src/window.c b/src/window.c index ab9bdb69..30957a4b 100644 --- a/src/window.c +++ b/src/window.c @@ -16,7 +16,7 @@ */ void window_update_class(i3Window *win, xcb_get_property_reply_t *prop, bool before_mgmt) { if (prop == NULL || xcb_get_property_value_length(prop) == 0) { - DLOG("empty property, not updating\n"); + DLOG("WM_CLASS not set.\n"); FREE(prop); return; } @@ -105,7 +105,7 @@ void window_update_name(i3Window *win, xcb_get_property_reply_t *prop, bool befo */ void window_update_name_legacy(i3Window *win, xcb_get_property_reply_t *prop, bool before_mgmt) { if (prop == NULL || xcb_get_property_value_length(prop) == 0) { - DLOG("prop == NULL\n"); + DLOG("WM_NAME not set (_NET_WM_NAME is what you want anyways).\n"); FREE(prop); return; } @@ -152,7 +152,7 @@ void window_update_name_legacy(i3Window *win, xcb_get_property_reply_t *prop, bo */ void window_update_leader(i3Window *win, xcb_get_property_reply_t *prop) { if (prop == NULL || xcb_get_property_value_length(prop) == 0) { - DLOG("prop == NULL\n"); + DLOG("CLIENT_LEADER not set.\n"); FREE(prop); return; } @@ -176,7 +176,7 @@ void window_update_leader(i3Window *win, xcb_get_property_reply_t *prop) { */ void window_update_transient_for(i3Window *win, xcb_get_property_reply_t *prop) { if (prop == NULL || xcb_get_property_value_length(prop) == 0) { - DLOG("prop == NULL\n"); + DLOG("TRANSIENT_FOR not set.\n"); FREE(prop); return; } @@ -200,7 +200,7 @@ void window_update_transient_for(i3Window *win, xcb_get_property_reply_t *prop) */ void window_update_strut_partial(i3Window *win, xcb_get_property_reply_t *prop) { if (prop == NULL || xcb_get_property_value_length(prop) == 0) { - DLOG("prop == NULL\n"); + DLOG("_NET_WM_STRUT_PARTIAL not set.\n"); FREE(prop); return; } @@ -225,7 +225,7 @@ void window_update_strut_partial(i3Window *win, xcb_get_property_reply_t *prop) */ void window_update_role(i3Window *win, xcb_get_property_reply_t *prop, bool before_mgmt) { if (prop == NULL || xcb_get_property_value_length(prop) == 0) { - DLOG("prop == NULL\n"); + DLOG("WM_WINDOW_ROLE not set.\n"); FREE(prop); return; } diff --git a/src/x.c b/src/x.c index 028987c8..246cbe49 100644 --- a/src/x.c +++ b/src/x.c @@ -274,21 +274,16 @@ void x_draw_decoration(Con *con) { parent->layout != L_TABBED) || con->type == CT_FLOATING_CON) return; - DLOG("decoration should be rendered for con %p\n", con); /* Skip containers whose height is 0 (for example empty dockareas) */ - if (con->rect.height == 0) { - DLOG("height == 0, not rendering\n"); + if (con->rect.height == 0) return; - } /* Skip containers whose pixmap has not yet been created (can happen when * decoration rendering happens recursively for a window for which * x_push_node() was not yet called) */ - if (leaf && con->pixmap == XCB_NONE) { - DLOG("pixmap not yet created, not rendering\n"); + if (leaf && con->pixmap == XCB_NONE) return; - } /* 1: build deco_params and compare with cache */ struct deco_render_params *p = scalloc(sizeof(struct deco_render_params)); @@ -319,15 +314,12 @@ void x_draw_decoration(Con *con) { !parent->pixmap_recreated && !con->pixmap_recreated && memcmp(p, con->deco_render_params, sizeof(struct deco_render_params)) == 0) { - DLOG("CACHE HIT, copying existing pixmaps\n"); free(p); goto copy_pixmaps; } - DLOG("CACHE MISS\n"); Con *next = con; while ((next = TAILQ_NEXT(next, nodes))) { - DLOG("Also invalidating cache of %p\n", next); FREE(next->deco_render_params); } @@ -395,10 +387,8 @@ void x_draw_decoration(Con *con) { /* if this is a borderless/1pixel window, we don’t * need to render the * decoration. */ - if (p->border_style != BS_NORMAL) { - DLOG("border style not BS_NORMAL, aborting rendering of decoration\n"); + if (p->border_style != BS_NORMAL) goto copy_pixmaps; - } /* 4: paint the bar */ xcb_change_gc_single(conn, parent->pm_gc, XCB_GC_FOREGROUND, p->color->background); @@ -445,7 +435,7 @@ void x_draw_decoration(Con *con) { Con *il_parent = parent; if (il_parent->layout != L_STACKED) { while (1) { - DLOG("il_parent = %p, layout = %d\n", il_parent, il_parent->layout); + //DLOG("il_parent = %p, layout = %d\n", il_parent, il_parent->layout); if (il_parent->layout == L_STACKED) indent_level++; if (il_parent->type == CT_WORKSPACE || il_parent->type == CT_DOCKAREA || il_parent->type == CT_OUTPUT) @@ -454,7 +444,7 @@ void x_draw_decoration(Con *con) { indent_mult++; } } - DLOG("indent_level = %d, indent_mult = %d\n", indent_level, indent_mult); + //DLOG("indent_level = %d, indent_mult = %d\n", indent_level, indent_mult); int indent_px = (indent_level * 5) * indent_mult; if (win->uses_net_wm_name) @@ -544,10 +534,8 @@ void x_push_node(Con *con) { } } rect.height = max_y + max_height; - if (rect.height == 0) { - DLOG("Unmapping container %p because it does not contain anything.\n", con); + if (rect.height == 0) con->mapped = false; - } } /* reparent the child window (when the window was moved due to a sticky @@ -591,9 +579,6 @@ void x_push_node(Con *con) { * (height == 0). */ if ((state->rect.width != rect.width || state->rect.height != rect.height)) { - DLOG("CACHE: creating new pixmap for con %p (old: %d x %d, new: %d x %d)\n", - con, state->rect.width, state->rect.height, - rect.width, rect.height); if (con->pixmap == 0) { con->pixmap = xcb_generate_id(conn); con->pm_gc = xcb_generate_id(conn); @@ -809,7 +794,7 @@ void x_push_changes(Con *con) { order_changed = true; if ((state->initial || order_changed) && prev != CIRCLEQ_END(&state_head)) { stacking_changed = true; - DLOG("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; @@ -825,7 +810,7 @@ void x_push_changes(Con *con) { if (stacking_changed) ewmh_update_client_list_stacking(btt_stack, btt_stack_num); - DLOG("\n\n PUSHING CHANGES\n\n"); + DLOG("PUSHING CHANGES\n"); x_push_node(con); //DLOG("Re-enabling EnterNotify\n"); @@ -842,7 +827,6 @@ void x_push_changes(Con *con) { if (focused->window != NULL) to_focus = focused->window->id; - DLOG("focused_id = 0x%08x, to_focus = 0x%08x\n", focused_id, to_focus); if (focused_id != to_focus) { if (!focused->mapped) { DLOG("Not updating focus (to %p / %s), focused window is not mapped.\n", focused, focused->name); @@ -896,7 +880,7 @@ void x_push_changes(Con *con) { } xcb_flush(conn); - DLOG("\n\n ENDING CHANGES\n\n"); + DLOG("ENDING CHANGES\n"); /* Disable EnterWindow events for windows which will be unmapped in * x_push_node_unmaps() now. Unmapping windows happens when switching