From: Fernando Tarlá Cardoso Lemos Date: Sat, 22 Jan 2011 17:54:49 +0000 (-0200) Subject: Round up as well if needed (thanks Merovius). X-Git-Tag: tree-pr2~107 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=485555ef72dc99cff68cab78cc0c9da914702618;p=i3%2Fi3 Round up as well if needed (thanks Merovius). --- diff --git a/src/render.c b/src/render.c index 9d214ce6..b79d463f 100644 --- a/src/render.c +++ b/src/render.c @@ -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; } } }