openbsd-ports/x11/i3/patches/patch-src_layout_c
2011-03-14 12:55:18 +00:00

30 lines
1.2 KiB
Plaintext

$OpenBSD: patch-src_layout_c,v 1.3 2011/03/14 12:55:18 dcoppa Exp $
--- src/layout.c.orig Wed Jan 19 21:26:37 2011
+++ src/layout.c Thu Mar 10 14:42:58 2011
@@ -713,9 +713,10 @@ void render_workspace(xcb_connection_t *conn, Output *
/* Correct rounding errors */
int error = r_ws->rect.width - total_col_width, error_index = r_ws->cols - 1;
+ int signal = error < 0 ? 1 : -1;
while (error) {
- ++col_width[error_index];
- --error;
+ col_width[error_index] -= signal;
+ error += signal;
error_index = error_index == 0 ? r_ws->cols - 1 : error_index - 1;
}
@@ -732,9 +733,10 @@ void render_workspace(xcb_connection_t *conn, Output *
/* Correct rounding errors */
error = workspace_height(r_ws) - total_row_height;
error_index = r_ws->rows - 1;
+ signal = error < 0 ? 1 : -1;
while (error) {
- ++row_height[error_index];
- --error;
+ row_height[error_index] -= signal;
+ error += signal;
error_index = error_index == 0 ? r_ws->rows - 1 : error_index - 1;
}