aspectresize.c (413B)
1 void 2 aspectresize(const Arg *arg) 3 { 4 /* only floating windows can be moved */ 5 Client *c; 6 c = selmon->sel; 7 float ratio; 8 int w, h,nw, nh; 9 10 if (!c || !arg) 11 return; 12 if (selmon->lt[selmon->sellt]->arrange && !c->isfloating) 13 return; 14 15 ratio = (float)c->w / (float)c->h; 16 h = arg->i; 17 w = (int)(ratio * h); 18 19 nw = c->w + w; 20 nh = c->h + h; 21 22 XRaiseWindow(dpy, c->win); 23 resize(c, c->x, c->y, nw, nh, True); 24 } 25