]> git.sur5r.net Git - i3/i3/commitdiff
Don’t round up if the corrected height/width is the same as the old one
authorMichael Stapelberg <michael@stapelberg.de>
Sun, 23 Aug 2009 18:30:17 +0000 (20:30 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Sun, 23 Aug 2009 18:30:17 +0000 (20:30 +0200)
src/layout.c

index 98429dc383a25045923cacddb2b39d5357da7f82..acb20128e96e8450c8429afbf88818267df7c696 100644 (file)
@@ -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);
         }