}
/* Misc */
+int residual(float num, float *state)
+{
+ float f = num + *state;
+ int i = (int)(f+0.5);
+ *state = f - i;
+ return i;
+}
+
int str2num(char *str, int def)
{
char *end = NULL;
list_t *list_sort(list_t *list, int rev, int (*func)(void*,void*));
/* Misc */
+int residual(float num, float *state);
+
int str2num(char *str, int def);
int warn(char *fmt, ...);
int mx=0, my=0; // Maximum usable size (screen size minus margins)
int sy=0; // Stack size (height of focused stack window)
+ float rx=0, ry=0; // Residuals for floating point round off
+
/* Scale horizontally */
x = dpy->geom->x;
mx = dpy->geom->w - (list_length(dpy->cols)+1)*margin;
for (list_t *lcol = dpy->cols; lcol; lcol = lcol->next)
tx += COL(lcol)->width;
for (list_t *lcol = dpy->cols; lcol; lcol = lcol->next)
- COL(lcol)->width *= (float)mx / tx;
+ COL(lcol)->width = residual(COL(lcol)->width * (float)mx/tx, &rx);
/* Scale each column vertically */
win_t *focus = get_focus();
}
win->h = ROW(lrow)->height;
state_t state = ST_SHOW;
- int height = 0;
switch (col->layout) {
case SPLIT:
- sys_move(win, x+margin, y+margin,
- col->width, win->h * ((float)my / ty));
- height = win->h;
- y += height + margin;
+ sys_move(win, x+margin, y+margin, col->width,
+ residual(win->h * ((float)my/ty), &ry));
+ y += win->h + margin;
break;
case STACK:
if (lrow->next && ROW(lrow->next)->win == col->row->win) {