From 02ea8feb54e56136a44eb0eab78e52d4d67c85c3 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 7 Nov 2009 20:02:22 +0100 Subject: [PATCH] wibox: Set a proper back pixel Currently wiboxes have their background set to "inherit parent pixmap". That means that each time a wibox is e.g. resized, the X server sets the wibox' content to the wallpaper and then immediately awesome redraws the wibox with the proper background. This causes flicker when you e.g. resize clients which have a titlebar. With this patch, wiboxes get their proper background color for their "back pixel" value. Now, instead of showing the wallpaper, the X server will fill the complete wibox with its background color. With this patch, the actual widgets will still flicker. Also, if the wibox has a background image, this image obviously won't be used by the X server and we get some flicker again. My next patch will address these issues. Signed-off-by: Uli Schlachter Signed-off-by: Julien Danjou --- wibox.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/wibox.c b/wibox.c index 5f8ae846..392e8ed4 100644 --- a/wibox.c +++ b/wibox.c @@ -166,11 +166,11 @@ wibox_init(wibox_t *w, int phys_screen) w->geometry.x, w->geometry.y, w->geometry.width, w->geometry.height, w->border_width, XCB_COPY_FROM_PARENT, s->root_visual, - XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL + XCB_CW_BACK_PIXEL | XCB_CW_BORDER_PIXEL | XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK, (const uint32_t []) { - XCB_BACK_PIXMAP_PARENT_RELATIVE, + w->ctx.bg.pixel, w->border_color.pixel, 1, XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT @@ -1047,7 +1047,16 @@ luaA_wibox_set_bg(lua_State *L, wibox_t *wibox) size_t len; const char *buf = luaL_checklstring(L, -1, &len); if(xcolor_init_reply(xcolor_init_unchecked(&wibox->ctx.bg, buf, len))) + { + uint32_t mask = XCB_CW_BACK_PIXEL; + uint32_t values[] = { wibox->ctx.bg.pixel }; + wibox->need_update = true; + xcb_change_window_attributes(globalconf.connection, + wibox->window, + mask, + values); + } luaA_object_emit_signal(L, -3, "property::bg", 0); return 0; } -- 2.11.4.GIT