From: Michael Stapelberg Date: Mon, 18 Apr 2011 19:10:50 +0000 (+0200) Subject: x: Set pixmap as background window, saves a lot of CopyAreas X-Git-Tag: tree-pr3~73 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=84b804cda61c9fda33521c11882b926ef4fc7f79;p=i3%2Fi3 x: Set pixmap as background window, saves a lot of CopyAreas --- diff --git a/src/x.c b/src/x.c index 9ea87644..22660d12 100644 --- a/src/x.c +++ b/src/x.c @@ -277,9 +277,9 @@ void x_draw_decoration(Con *con) { (con->window == NULL || !con->window->name_x_changed) && !con->parent->pixmap_recreated && memcmp(p, con->deco_render_params, sizeof(struct deco_render_params)) == 0) { - DLOG("CACHE HIT, copying existing pixmaps\n"); + DLOG("CACHE HIT, not re-rendering\n"); free(p); - goto copy_pixmaps; + return; } DLOG("CACHE MISS\n"); @@ -350,7 +350,7 @@ void x_draw_decoration(Con *con) { * decoration. */ if (p->border_style != BS_NORMAL) { DLOG("border style not BS_NORMAL, aborting rendering of decoration\n"); - goto copy_pixmaps; + goto update_pixmaps; } /* 4: paint the bar */ @@ -390,7 +390,7 @@ void x_draw_decoration(Con *con) { "another container" ); - goto copy_pixmaps; + goto update_pixmaps; } int indent_level = 0, @@ -431,9 +431,9 @@ void x_draw_decoration(Con *con) { win->name_x ); -copy_pixmaps: - xcb_copy_area(conn, con->pixmap, con->frame, con->pm_gc, 0, 0, 0, 0, con->rect.width, con->rect.height); - xcb_copy_area(conn, parent->pixmap, parent->frame, parent->pm_gc, 0, 0, 0, 0, parent->rect.width, parent->rect.height); +update_pixmaps: + xcb_clear_area(conn, false, con->frame, 0, 0, con->rect.width, con->rect.height); + xcb_clear_area(conn, false, parent->frame, 0, 0, parent->rect.width, parent->rect.height); } /* @@ -526,6 +526,8 @@ void x_push_node(Con *con, bool skip_decoration) { } xcb_create_pixmap(conn, root_depth, con->pixmap, con->frame, rect.width, rect.height); xcb_create_gc(conn, con->pm_gc, con->pixmap, 0, 0); + uint32_t values[] = { con->pixmap }; + xcb_change_window_attributes(conn, con->frame, XCB_CW_BACK_PIXMAP, values); con->pixmap_recreated = true; } memcpy(&(state->rect), &rect, sizeof(Rect));