In C, dividing two integers automatically rounds towards zero, so ceil(a
/ b) is useless as the result is truncated before ceil ever sees it. The
correct result for positive integers is obtained by (a + b - 1) / b.
---
src/window.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/window.c b/src/window.c
index f33514d..39116db 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2808,8 +2808,8 @@ static void frameMouseDown(WObjDescriptor *desc, XEvent
*event)
unsigned int resize_height_increment = 0;
if (wwin->normal_hints) {
- w_scale = ceil(wPreferences.resize_increment /
wwin->normal_hints->width_inc);
- h_scale = ceil(wPreferences.resize_increment /
wwin->normal_hints->height_inc);
+ w_scale = (wPreferences.resize_increment +
wwin->normal_hints->width_inc - 1) / wwin->normal_hints->width_inc;
+ h_scale = (wPreferences.resize_increment +
wwin->normal_hints->height_inc - 1) / wwin->normal_hints->height_inc;
resize_width_increment = wwin->normal_hints->width_inc *
w_scale;
resize_height_increment = wwin->normal_hints->height_inc *
h_scale;
}
--
1.7.0.4
--
To unsubscribe, send mail to [email protected].