From: Orestis Floros Date: Thu, 23 Aug 2018 18:57:21 +0000 (+0300) Subject: precalculate_sizes: round sizes instead of flooring them X-Git-Tag: 4.16~54^2~7 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7b9318a5412c38340701c54f1d516748f053f780;p=i3%2Fi3 precalculate_sizes: round sizes instead of flooring them This will lead to more accurate and consistent container sizes. Needed to fix the failing test of #3240. --- diff --git a/src/render.c b/src/render.c index 0125b89d..8699660e 100644 --- a/src/render.c +++ b/src/render.c @@ -192,7 +192,7 @@ static int *precalculate_sizes(Con *con, render_params *p) { int total = con_orientation(con) == HORIZ ? p->rect.width : p->rect.height; TAILQ_FOREACH(child, &(con->nodes_head), nodes) { double percentage = child->percent > 0.0 ? child->percent : 1.0 / p->children; - assigned += sizes[i++] = percentage * total; + assigned += sizes[i++] = lround(percentage * total); } assert(assigned == total || (assigned > total && assigned - total <= p->children * 2) ||