]> git.sur5r.net Git - i3/i3/commitdiff
render_con: fix height rounding in aspect ratio computation
authorClément Bœsch <ubitux@gmail.com>
Sat, 20 Apr 2013 21:47:37 +0000 (23:47 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Tue, 23 Apr 2013 05:18:35 +0000 (07:18 +0200)
With a 484x292 window and proportion of 488x294, new_height is
291.590164 after the loop, causing a rounding issue leading to a window
of 484x291.

src/render.c

index 6061838a15e0e97d09b3ef8a726f5ff23ef40c1f..c0a0fedfe4848b70c6b3c229fbe760115cd2b67b 100644 (file)
@@ -184,10 +184,10 @@ void render_con(Con *con, bool render_fullscreen) {
                     new_width--;
             }
             /* Center the window */
-            inset->y += ceil(inset->height / 2) - floor(new_height / 2);
+            inset->y += ceil(inset->height / 2) - floor((new_height + .5) / 2);
             inset->x += ceil(inset->width / 2) - floor(new_width / 2);
 
-            inset->height = new_height;
+            inset->height = new_height + .5;
             inset->width = new_width;
         }