diff --git a/objects/client.c b/objects/client.c index e3dc350bb..aed2b34c8 100644 --- a/objects/client.c +++ b/objects/client.c @@ -1699,19 +1699,39 @@ titlebar_resize(client_t *c, client_titlebar_t bar, int size) * titlebars should keep its current size!) */ area_t geometry = c->geometry; int change = size - c->titlebar[bar].size; + int16_t diff_top = 0, diff_bottom = 0, diff_right = 0, diff_left = 0; switch (bar) { case CLIENT_TITLEBAR_TOP: + geometry.height += change; + diff_top = change; + break; case CLIENT_TITLEBAR_BOTTOM: geometry.height += change; + diff_bottom = change; break; case CLIENT_TITLEBAR_RIGHT: + geometry.width += change; + diff_right = change; + break; case CLIENT_TITLEBAR_LEFT: geometry.width += change; + diff_left = change; break; default: fatal("Unknown titlebar kind %d\n", (int) bar); } + if(c->size_hints.flags & XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY) + { + int16_t diff_x = 0, diff_y = 0; + xwindow_translate_for_gravity(c->size_hints.win_gravity, + diff_left, diff_top, + diff_right, diff_bottom, + &diff_x, &diff_y); + geometry.x += diff_x; + geometry.y += diff_y; + } + c->titlebar[bar].size = size; client_resize_do(c, geometry, true, false); }