Round up as well if needed (thanks Merovius).
This commit is contained in:
parent
ca296c1c8b
commit
ceff1487da
10
src/layout.c
10
src/layout.c
|
@ -713,9 +713,10 @@ void render_workspace(xcb_connection_t *conn, Output *output, Workspace *r_ws) {
|
||||||
|
|
||||||
/* Correct rounding errors */
|
/* Correct rounding errors */
|
||||||
int error = r_ws->rect.width - total_col_width, error_index = r_ws->cols - 1;
|
int error = r_ws->rect.width - total_col_width, error_index = r_ws->cols - 1;
|
||||||
|
int signal = error < 0 ? 1 : -1;
|
||||||
while (error) {
|
while (error) {
|
||||||
++col_width[error_index];
|
col_width[error_index] -= signal;
|
||||||
--error;
|
error += signal;
|
||||||
error_index = error_index == 0 ? r_ws->cols - 1 : error_index - 1;
|
error_index = error_index == 0 ? r_ws->cols - 1 : error_index - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -732,9 +733,10 @@ void render_workspace(xcb_connection_t *conn, Output *output, Workspace *r_ws) {
|
||||||
/* Correct rounding errors */
|
/* Correct rounding errors */
|
||||||
error = workspace_height(r_ws) - total_row_height;
|
error = workspace_height(r_ws) - total_row_height;
|
||||||
error_index = r_ws->rows - 1;
|
error_index = r_ws->rows - 1;
|
||||||
|
signal = error < 0 ? 1 : -1;
|
||||||
while (error) {
|
while (error) {
|
||||||
++row_height[error_index];
|
row_height[error_index] -= signal;
|
||||||
--error;
|
error += signal;
|
||||||
error_index = error_index == 0 ? r_ws->rows - 1 : error_index - 1;
|
error_index = error_index == 0 ? r_ws->rows - 1 : error_index - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue