From 8c4e2e48f4d150135ae1496b87aa9b5f9dd79e4b Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sun, 23 Aug 2009 20:30:17 +0200 Subject: [PATCH] =?utf8?q?Don=E2=80=99t=20round=20up=20if=20the=20correcte?= =?utf8?q?d=20height/width=20is=20the=20same=20as=20the=20old=20one?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/layout.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/layout.c b/src/layout.c index 98429dc3..acb20128 100644 --- a/src/layout.c +++ b/src/layout.c @@ -298,14 +298,21 @@ void resize_client(xcb_connection_t *conn, Client *client) { if (client->height_increment > 1) { int old_height = rect->height; - rect->height = ((int)(rect->height / client->height_increment) * client->height_increment) + 1; + rect->height = ((int)(rect->height / client->height_increment) * client->height_increment); + /* We round up if the height was changed */ + if (rect->height != old_height) + rect->height++; LOG("Lost %d pixel due to client's height_increment (%d px)\n", old_height - rect->height, client->height_increment); } if (client->width_increment > 1) { int old_width = rect->width; - rect->width = ((int)(rect->width / client->width_increment) * client->width_increment) + 1; + rect->width = ((int)(rect->width / client->width_increment) * client->width_increment); + /* We round up if the height was changed */ + if (rect->width != old_width) + rect->width++; + LOG("Lost %d pixel due to client's width_increment (%d px)\n", old_width - rect->width, client->width_increment); } -- 2.39.5