From 78541da82a77449bb734a8edb7d860b9fec0ba57 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 15 Nov 2009 13:36:48 +0100 Subject: [PATCH] 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 Signed-off-by: Julien Danjou --- wibox.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/wibox.c b/wibox.c index 6b2b44e06..015e2d01c 100644 --- a/wibox.c +++ b/wibox.c @@ -336,8 +336,9 @@ static void wibox_set_border_color(lua_State *L, int udx, const xcolor_t *color) { wibox_t *w = luaA_checkudata(L, udx, &wibox_class); - xcb_change_window_attributes(globalconf.connection, w->window, - XCB_CW_BORDER_PIXEL, &color->pixel); + if (w->window != XCB_NONE) + xcb_change_window_attributes(globalconf.connection, w->window, + XCB_CW_BORDER_PIXEL, &color->pixel); w->border_color = *color; luaA_object_emit_signal(L, udx, "property::border_color", 0); } @@ -1464,8 +1465,9 @@ 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) { - xcb_configure_window(globalconf.connection, w->window, XCB_CONFIG_WINDOW_BORDER_WIDTH, - &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; /* Need update if transparent background */ wibox_need_update(w);