rem: width = (height * sizeh->max_aspect.x) / sizeh->max_aspect.y; if (width > sizeh->max_width) { width = sizeh->max_width; height = (width*sizeh->max_aspect.y) / sizeh->max_aspect.x;
add: width = (height * maxAX) / maxAY; if (width > maxW) { width = maxW; height = (width * maxAY) / maxAX;
context: wWindowConstrainSize(WWindow *wwin, int *nwidth, int *nheight){    XSizeHints *sizeh = wwin->normal_hints;    int width = *nwidth;    int height = *nheight;    int winc = sizeh->width_inc;    int hinc = sizeh->height_inc;    if (width < sizeh->min_width)      width = sizeh->min_width;    if (height < sizeh->min_height)      height = sizeh->min_height;    if (width > sizeh->max_width)       width = sizeh->max_width;    if (height > sizeh->max_height)       height = sizeh->max_height;        /* aspect ratio code borrowed from olwm */    if (sizeh->flags & PAspect) {	/* adjust max aspect ratio */	if (!(sizeh->max_aspect.x==1 && sizeh->max_aspect.y==1)	    && width * sizeh->max_aspect.y > height * sizeh->max_aspect.x) {	    if (sizeh->max_aspect.x > sizeh->max_aspect.y) {		height = (width * sizeh->max_aspect.y) / sizeh->max_aspect.x;		if (height > sizeh->max_height) {		    height = sizeh->max_height;		    width = (height*sizeh->max_aspect.x) / sizeh->max_aspect.y;		}	    } else {		width = (height * sizeh->max_aspect.x) / sizeh->max_aspect.y;		if (width > sizeh->max_width) {		    width = sizeh->max_width;		    height = (width*sizeh->max_aspect.y) / sizeh->max_aspect.x;		}	    }	}	/* adjust min aspect ratio */	if (!(sizeh->min_aspect.x==1 && sizeh->min_aspect.y==1)	    && width * sizeh->min_aspect.y < height * sizeh->min_aspect.x) {	    if (sizeh->min_aspect.x > sizeh->min_aspect.y) {		height = (width * sizeh->min_aspect.y) / sizeh->min_aspect.x;		if (height < sizeh->min_height) {		    height = sizeh->min_height;		    width = (height*sizeh->min_aspect.x) / sizeh->min_aspect.y;		}	    } else {		width = (height * sizeh->min_aspect.x) / sizeh->min_aspect.y;		if (width < sizeh->min_width) {		    width = sizeh->min_width;		    height = (width*sizeh->min_aspect.y) / sizeh->min_aspect.x;		}	    }	}    }    if (sizeh->base_width != 0) {	width = (((width - sizeh->base_width) / winc) * winc) 	    + sizeh->base_width;    } else {	width = (((width - sizeh->min_width) / winc) * winc)	  + sizeh->min_width;    }    if (sizeh->base_width != 0) {	height = (((height - sizeh->base_height) / hinc) * hinc)	  + sizeh->base_height;    } else {	height = (((height - sizeh->min_height) / hinc) * hinc) 	  + sizeh->min_height;    }        *nwidth = width;    *nheight = height;}