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:
parent
8966715b26
commit
0194c5daf9
|
@ -363,8 +363,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);
|
||||
}
|
||||
|
@ -1295,8 +1296,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);
|
||||
|
|
Loading…
Reference in New Issue