]> git.sur5r.net Git - i3/i3/commitdiff
Round up as well if needed (thanks Merovius).
authorFernando Tarlá Cardoso Lemos <fernandotcl@gmail.com>
Sat, 22 Jan 2011 17:54:49 +0000 (15:54 -0200)
committerMichael Stapelberg <michael@stapelberg.de>
Sun, 23 Jan 2011 12:21:33 +0000 (13:21 +0100)
src/render.c

index 9d214ce6fe3c98b58d4f637bee1fb16a54b5f751..b79d463fa9f9967ed430db0bcf9cdb82b16dac70 100644 (file)
@@ -118,10 +118,11 @@ void render_con(Con *con, bool render_fullscreen) {
             double percentage = child->percent > 0.0 ? child->percent : 1.0 / children;
             assigned += sizes[i++] = percentage * total;
         }
-        while (assigned < total) {
+        int signal = assigned < total ? 1 : -1;
+        while (assigned != total) {
             for (i = 0; i < children && assigned < total; ++i) {
-                ++sizes[i];
-                ++assigned;
+                sizes[i] += signal;
+                assigned += signal;
             }
         }
     }