wibox: check if a wibox' window exists before modifying it

If you change the .bg of an existing wibox which isn't attached to any screen
yet, then there is no window for which we can update the XCB_CW_BACK_PIXEL.

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-08 11:03:56 +01:00 committed by Julien Danjou
parent 8ed6d60a25
commit c912da0189
1 changed files with 6 additions and 4 deletions

10
wibox.c
View File

@ -1053,10 +1053,12 @@ luaA_wibox_set_bg(lua_State *L, wibox_t *wibox)
uint32_t values[] = { wibox->ctx.bg.pixel };
wibox->need_update = true;
xcb_change_window_attributes(globalconf.connection,
wibox->window,
mask,
values);
if (wibox->window != XCB_NONE)
xcb_change_window_attributes(globalconf.connection,
wibox->window,
mask,
values);
}
luaA_object_emit_signal(L, -3, "property::bg", 0);
return 0;