Round up as well if needed (thanks Merovius).

next
Fernando Tarlá Cardoso Lemos 2011-01-22 15:54:49 -02:00 committed by Michael Stapelberg
parent d9dd245bcc
commit 485555ef72
1 changed files with 4 additions and 3 deletions

View 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;
}
}
}