From 1bb3b07177bffe0f8b241f2b650dc6fffe6b9fb7 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 --- objects/wibox.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/objects/wibox.c b/objects/wibox.c index 90db40fe..16195930 100644 --- a/objects/wibox.c +++ b/objects/wibox.c @@ -193,11 +193,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 @@ -1004,7 +1004,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; }