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
6c5d0ca90c
commit
78541da82a
10
wibox.c
10
wibox.c
|
@ -336,8 +336,9 @@ static void
|
||||||
wibox_set_border_color(lua_State *L, int udx, const xcolor_t *color)
|
wibox_set_border_color(lua_State *L, int udx, const xcolor_t *color)
|
||||||
{
|
{
|
||||||
wibox_t *w = luaA_checkudata(L, udx, &wibox_class);
|
wibox_t *w = luaA_checkudata(L, udx, &wibox_class);
|
||||||
xcb_change_window_attributes(globalconf.connection, w->window,
|
if (w->window != XCB_NONE)
|
||||||
XCB_CW_BORDER_PIXEL, &color->pixel);
|
xcb_change_window_attributes(globalconf.connection, w->window,
|
||||||
|
XCB_CW_BORDER_PIXEL, &color->pixel);
|
||||||
w->border_color = *color;
|
w->border_color = *color;
|
||||||
luaA_object_emit_signal(L, udx, "property::border_color", 0);
|
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);
|
uint32_t border_width = luaL_checknumber(L, -1);
|
||||||
if(border_width != w->border_width)
|
if(border_width != w->border_width)
|
||||||
{
|
{
|
||||||
xcb_configure_window(globalconf.connection, w->window, XCB_CONFIG_WINDOW_BORDER_WIDTH,
|
if (w->window != XCB_NONE)
|
||||||
&border_width);
|
xcb_configure_window(globalconf.connection, w->window, XCB_CONFIG_WINDOW_BORDER_WIDTH,
|
||||||
|
&border_width);
|
||||||
w->border_width = border_width;
|
w->border_width = border_width;
|
||||||
/* Need update if transparent background */
|
/* Need update if transparent background */
|
||||||
wibox_need_update(w);
|
wibox_need_update(w);
|
||||||
|
|
Loading…
Reference in New Issue