From e57e4a99c5f1d2173640b90fb913fdc66ff40217 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 3 Nov 2012 18:44:44 +0100 Subject: [PATCH] Enlarge clients when adding titlebars Previously, the area of the window that the client could draw to got smaller when titlebars are added. This causes all sorts of odd-looking effects, so instead this should enlarge the window suitably. Signed-off-by: Uli Schlachter --- objects/client.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/objects/client.c b/objects/client.c index 09dff8e7..40099360 100644 --- a/objects/client.c +++ b/objects/client.c @@ -601,9 +601,9 @@ client_send_configure(client_t *c) } static void -client_resize_do(client_t *c, area_t geometry) +client_resize_do(client_t *c, area_t geometry, bool force_notice) { - bool send_notice = false; + bool send_notice = force_notice; screen_t *new_screen = screen_getbycoord(geometry.x, geometry.y); if(c->geometry.width == geometry.width @@ -727,7 +727,7 @@ client_resize(client_t *c, area_t geometry) || c->geometry.width != geometry.width || c->geometry.height != geometry.height) { - client_resize_do(c, geometry); + client_resize_do(c, geometry, false); return true; } @@ -1409,9 +1409,25 @@ titlebar_resize(client_t *c, client_titlebar_t bar, int size) if (size == c->titlebar[bar].size) return; - /* Now resize the client (and titlebars!) suitably */ + /* Now resize the client (and titlebars!) suitably (the client without + * titlebars should keep its current size!) */ + area_t geometry = c->geometry; + int change = size - c->titlebar[bar].size; + switch (bar) { + case CLIENT_TITLEBAR_TOP: + case CLIENT_TITLEBAR_BOTTOM: + geometry.height += change; + break; + case CLIENT_TITLEBAR_RIGHT: + case CLIENT_TITLEBAR_LEFT: + geometry.width += change; + break; + default: + fatal("Unknown titlebar kind %d\n", (int) bar); + } + c->titlebar[bar].size = size; - client_resize_do(c, c->geometry); + client_resize_do(c, geometry, true); } #define HANDLE_TITLEBAR(name, index) \