Wibox: Check if a window exists before changing it

wibox_set_border_color() and luaA_wibox_set_border_width() didn't check if a
wibox really had an associated X11 window before changing this window which
resulted in (silent) errors.

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-15 13:36:48 +01:00 committed by Julien Danjou
parent 6c5d0ca90c
commit 78541da82a
1 changed files with 6 additions and 4 deletions

View File

@ -336,6 +336,7 @@ static void
wibox_set_border_color(lua_State *L, int udx, const xcolor_t *color)
{
wibox_t *w = luaA_checkudata(L, udx, &wibox_class);
if (w->window != XCB_NONE)
xcb_change_window_attributes(globalconf.connection, w->window,
XCB_CW_BORDER_PIXEL, &color->pixel);
w->border_color = *color;
@ -1464,6 +1465,7 @@ luaA_wibox_set_border_width(lua_State *L, wibox_t *wibox)
uint32_t border_width = luaL_checknumber(L, -1);
if(border_width != w->border_width)
{
if (w->window != XCB_NONE)
xcb_configure_window(globalconf.connection, w->window, XCB_CONFIG_WINDOW_BORDER_WIDTH,
&border_width);
w->border_width = border_width;