x: Set pixmap as background window, saves a lot of CopyAreas

This commit is contained in:
Michael Stapelberg 2011-04-18 21:10:50 +02:00
parent 3d5af35fa4
commit 84b804cda6
1 changed files with 9 additions and 7 deletions

16
src/x.c
View File

@ -277,9 +277,9 @@ void x_draw_decoration(Con *con) {
(con->window == NULL || !con->window->name_x_changed) && (con->window == NULL || !con->window->name_x_changed) &&
!con->parent->pixmap_recreated && !con->parent->pixmap_recreated &&
memcmp(p, con->deco_render_params, sizeof(struct deco_render_params)) == 0) { 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); free(p);
goto copy_pixmaps; return;
} }
DLOG("CACHE MISS\n"); DLOG("CACHE MISS\n");
@ -350,7 +350,7 @@ void x_draw_decoration(Con *con) {
* decoration. */ * decoration. */
if (p->border_style != BS_NORMAL) { if (p->border_style != BS_NORMAL) {
DLOG("border style not BS_NORMAL, aborting rendering of decoration\n"); DLOG("border style not BS_NORMAL, aborting rendering of decoration\n");
goto copy_pixmaps; goto update_pixmaps;
} }
/* 4: paint the bar */ /* 4: paint the bar */
@ -390,7 +390,7 @@ void x_draw_decoration(Con *con) {
"another container" "another container"
); );
goto copy_pixmaps; goto update_pixmaps;
} }
int indent_level = 0, int indent_level = 0,
@ -431,9 +431,9 @@ void x_draw_decoration(Con *con) {
win->name_x win->name_x
); );
copy_pixmaps: update_pixmaps:
xcb_copy_area(conn, con->pixmap, con->frame, con->pm_gc, 0, 0, 0, 0, con->rect.width, con->rect.height); xcb_clear_area(conn, false, con->frame, 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); 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_pixmap(conn, root_depth, con->pixmap, con->frame, rect.width, rect.height);
xcb_create_gc(conn, con->pm_gc, con->pixmap, 0, 0); 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; con->pixmap_recreated = true;
} }
memcpy(&(state->rect), &rect, sizeof(Rect)); memcpy(&(state->rect), &rect, sizeof(Rect));