Handle border width changes in ConfigureRequests early

The function window_set_border_width() causes its own gravity handling.
Thus, to make sure that this gravity handling does not interfere with
what the code in here does later, we just apply changes to the border
width first, and then do everything else.

Signed-off-by: Uli Schlachter <uli.schlachter@informatik.uni-oldenburg.de>
This commit is contained in:
Uli Schlachter 2018-08-20 10:33:06 +02:00
parent 2ebd120223
commit 62d27950fa
1 changed files with 10 additions and 14 deletions

24
event.c
View File

@ -329,6 +329,14 @@ event_handle_configurerequest(xcb_configure_request_event_t *ev)
if((c = client_getbywin(ev->window))) if((c = client_getbywin(ev->window)))
{ {
lua_State *L = globalconf_get_lua_State();
if(ev->value_mask & XCB_CONFIG_WINDOW_BORDER_WIDTH)
{
luaA_object_push(L, c);
window_set_border_width(L, -1, ev->border_width);
lua_pop(L, 1);
}
area_t geometry = c->geometry; area_t geometry = c->geometry;
uint16_t bw = c->border_width; uint16_t bw = c->border_width;
uint16_t tb_left = c->titlebar[CLIENT_TITLEBAR_LEFT].size; uint16_t tb_left = c->titlebar[CLIENT_TITLEBAR_LEFT].size;
@ -339,9 +347,7 @@ event_handle_configurerequest(xcb_configure_request_event_t *ev)
uint16_t deco_right = bw + tb_right; uint16_t deco_right = bw + tb_right;
uint16_t deco_top = bw + tb_top; uint16_t deco_top = bw + tb_top;
uint16_t deco_bottom = bw + tb_bottom; uint16_t deco_bottom = bw + tb_bottom;
int16_t diff_w = 0, diff_h = 0, diff_border = 0; int16_t diff_w = 0, diff_h = 0;
lua_State *L = globalconf_get_lua_State();
if(ev->value_mask & XCB_CONFIG_WINDOW_WIDTH) if(ev->value_mask & XCB_CONFIG_WINDOW_WIDTH)
{ {
@ -359,21 +365,11 @@ event_handle_configurerequest(xcb_configure_request_event_t *ev)
geometry.height += tb_top + tb_bottom; geometry.height += tb_top + tb_bottom;
diff_h = geometry.height - old_h; diff_h = geometry.height - old_h;
} }
if(ev->value_mask & XCB_CONFIG_WINDOW_BORDER_WIDTH)
{
diff_border = ev->border_width - bw;
diff_h += diff_border;
diff_w += diff_border;
luaA_object_push(L, c);
window_set_border_width(L, -1, ev->border_width);
lua_pop(L, 1);
}
/* If the client resizes without moving itself, apply window gravity */ /* If the client resizes without moving itself, apply window gravity */
if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY) if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY)
{ {
xwindow_translate_for_gravity(c->size_hints.win_gravity, diff_border, diff_border, diff_w, diff_h, &geometry.x, &geometry.y); xwindow_translate_for_gravity(c->size_hints.win_gravity, 0, 0, diff_w, diff_h, &geometry.x, &geometry.y);
} }
if(ev->value_mask & XCB_CONFIG_WINDOW_X) if(ev->value_mask & XCB_CONFIG_WINDOW_X)
{ {