mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +01:00
Fix wheel resizing with resize increments
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.
This commit is contained in:
committed by
Carlos R. Mafra
parent
4ddc2a5a0a
commit
68bd644b0d
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user