Lazily apply changes to border_width and border_color
Fixes: https://github.com/awesomeWM/awesome/issues/592 Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
f9d15691b8
commit
ee7a41370f
2
event.h
2
event.h
|
@ -36,6 +36,7 @@ void drawin_refresh(void);
|
||||||
|
|
||||||
/* objects/client.c */
|
/* objects/client.c */
|
||||||
void client_focus_refresh(void);
|
void client_focus_refresh(void);
|
||||||
|
void client_border_refresh(void);
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
awesome_refresh(void)
|
awesome_refresh(void)
|
||||||
|
@ -44,6 +45,7 @@ awesome_refresh(void)
|
||||||
banning_refresh();
|
banning_refresh();
|
||||||
stack_refresh();
|
stack_refresh();
|
||||||
drawin_refresh();
|
drawin_refresh();
|
||||||
|
client_border_refresh();
|
||||||
client_focus_refresh();
|
client_focus_refresh();
|
||||||
return xcb_flush(globalconf.connection);
|
return xcb_flush(globalconf.connection);
|
||||||
}
|
}
|
||||||
|
|
|
@ -453,6 +453,13 @@ client_focus_refresh(void)
|
||||||
win, globalconf.timestamp);
|
win, globalconf.timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
client_border_refresh(void)
|
||||||
|
{
|
||||||
|
foreach(c, globalconf.clients)
|
||||||
|
window_border_refresh((window_t *) *c);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
border_width_callback(client_t *c, uint16_t old_width, uint16_t new_width)
|
border_width_callback(client_t *c, uint16_t old_width, uint16_t new_width)
|
||||||
{
|
{
|
||||||
|
|
|
@ -165,7 +165,10 @@ void
|
||||||
drawin_refresh(void)
|
drawin_refresh(void)
|
||||||
{
|
{
|
||||||
foreach(item, globalconf.drawins)
|
foreach(item, globalconf.drawins)
|
||||||
|
{
|
||||||
drawin_apply_moveresize(*item);
|
drawin_apply_moveresize(*item);
|
||||||
|
window_border_refresh((window_t *) *item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Move and/or resize a drawin
|
/** Move and/or resize a drawin
|
||||||
|
|
|
@ -148,6 +148,19 @@ luaA_window_get_opacity(lua_State *L, window_t *window)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
window_border_refresh(window_t *window)
|
||||||
|
{
|
||||||
|
if(!window->border_need_update)
|
||||||
|
return;
|
||||||
|
window->border_need_update = false;
|
||||||
|
xwindow_set_border_color(window_get(window), &window->border_color);
|
||||||
|
if(window->window)
|
||||||
|
xcb_configure_window(globalconf.connection, window_get(window),
|
||||||
|
XCB_CONFIG_WINDOW_BORDER_WIDTH,
|
||||||
|
(uint32_t[]) { window->border_width });
|
||||||
|
}
|
||||||
|
|
||||||
/** Set the window border color.
|
/** Set the window border color.
|
||||||
* \param L The Lua VM state.
|
* \param L The Lua VM state.
|
||||||
* \param window The window object.
|
* \param window The window object.
|
||||||
|
@ -162,7 +175,7 @@ luaA_window_set_border_color(lua_State *L, window_t *window)
|
||||||
if(color_name &&
|
if(color_name &&
|
||||||
color_init_reply(color_init_unchecked(&window->border_color, color_name, len)))
|
color_init_reply(color_init_unchecked(&window->border_color, color_name, len)))
|
||||||
{
|
{
|
||||||
xwindow_set_border_color(window_get(window), &window->border_color);
|
window->border_need_update = true;
|
||||||
luaA_object_emit_signal(L, -3, "property::border_color", 0);
|
luaA_object_emit_signal(L, -3, "property::border_color", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,11 +196,7 @@ window_set_border_width(lua_State *L, int idx, int width)
|
||||||
if(width == window->border_width || width < 0)
|
if(width == window->border_width || width < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(window->window)
|
window->border_need_update = true;
|
||||||
xcb_configure_window(globalconf.connection, window_get(window),
|
|
||||||
XCB_CONFIG_WINDOW_BORDER_WIDTH,
|
|
||||||
(uint32_t[]) { width });
|
|
||||||
|
|
||||||
window->border_width = width;
|
window->border_width = width;
|
||||||
|
|
||||||
if(window->border_width_callback)
|
if(window->border_width_callback)
|
||||||
|
|
|
@ -62,6 +62,8 @@ typedef enum
|
||||||
strut_t strut; \
|
strut_t strut; \
|
||||||
/** Button bindings */ \
|
/** Button bindings */ \
|
||||||
button_array_t buttons; \
|
button_array_t buttons; \
|
||||||
|
/** Do we have pending border changes? */ \
|
||||||
|
bool border_need_update; \
|
||||||
/** Border color */ \
|
/** Border color */ \
|
||||||
color_t border_color; \
|
color_t border_color; \
|
||||||
/** Border width */ \
|
/** Border width */ \
|
||||||
|
@ -83,6 +85,7 @@ void window_class_setup(lua_State *);
|
||||||
|
|
||||||
void window_set_opacity(lua_State *, int, double);
|
void window_set_opacity(lua_State *, int, double);
|
||||||
void window_set_border_width(lua_State *, int, int);
|
void window_set_border_width(lua_State *, int, int);
|
||||||
|
void window_border_refresh(window_t *);
|
||||||
int luaA_window_get_type(lua_State *, window_t *);
|
int luaA_window_get_type(lua_State *, window_t *);
|
||||||
int luaA_window_set_type(lua_State *, window_t *);
|
int luaA_window_set_type(lua_State *, window_t *);
|
||||||
uint32_t window_translate_type(window_type_t);
|
uint32_t window_translate_type(window_type_t);
|
||||||
|
|
Loading…
Reference in New Issue