From 84b804cda61c9fda33521c11882b926ef4fc7f79 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 18 Apr 2011 21:10:50 +0200 Subject: [PATCH] x: Set pixmap as background window, saves a lot of CopyAreas --- src/x.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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));