Take into account the window’s base_{width,height} when resizing (Thanks Mirko)

This commit is contained in:
Michael Stapelberg
2009-12-12 22:27:57 +01:00
parent 8d8804221b
commit f87b98e0a7
3 changed files with 56 additions and 6 deletions

View File

@ -26,6 +26,7 @@
#include "client.h"
#include "table.h"
#include "workspace.h"
#include "config.h"
/*
* Removes the given client from the container, either because it will be inserted into another
@ -372,3 +373,38 @@ void client_mark(xcb_connection_t *conn, Client *client, const char *mark) {
break;
}
}
/*
* Returns the minimum height of a specific window. The height is calculated
* by using 2 pixels (for the client window itself), possibly padding this to
* comply with the clients base_height and then adding the decoration height.
*
*/
uint32_t client_min_height(Client *client) {
uint32_t height = max(2, client->base_height);
i3Font *font = load_font(global_conn, config.font);
if (client->titlebar_position == TITLEBAR_OFF && client->borderless)
return height;
if (client->titlebar_position == TITLEBAR_OFF && !client->borderless)
return height + 2;
return height + font->height + 2 + 2;
}
/*
* See client_min_height.
*
*/
uint32_t client_min_width(Client *client) {
uint32_t width = max(2, client->base_width);
if (client->titlebar_position == TITLEBAR_OFF && client->borderless)
return width;
if (client->titlebar_position == TITLEBAR_OFF && !client->borderless)
return width + 2;
return width + 2 + 2;
}