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 <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Uli Schlachter 2009-11-07 20:02:22 +01:00 committed by Julien Danjou
parent 2577f945d6
commit 02ea8feb54
1 changed files with 11 additions and 2 deletions

13
wibox.c
View File

@ -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;
}