Cascade windows when the floating layer fills, rather than placing them randomly.

This commit is contained in:
Kris Maglione 2008-04-05 14:36:17 -04:00
parent cbfa4688a4
commit 8a2782bba3
1 changed files with 10 additions and 7 deletions

View File

@ -101,8 +101,7 @@ float_placeframe(Frame *f) {
vp2 = &rvec2;
/* Find all rectangles on the floating layer into which
* the new frame would fit. (Please ignore the man behind
* the curtain).
* the new frame would fit.
*/
vector_rpush(vp, a->r);
for(ff=a->frame; ff; ff=ff->anext) {
@ -130,10 +129,15 @@ float_placeframe(Frame *f) {
vp2 = vptemp;
}
p = ZP; /* SET(p) */
p = ZP;
if(vp->n == 0) {
p.x = random() % max(1, Dx(a->r) - dim.x);
p.y = random() % max(1, Dy(a->r) - dim.y);
/* Cascade. */
ff = a->sel;
if(ff)
p = addpt(ff->r.min, Pt(Dy(ff->titlebar), Dy(ff->titlebar)));
if(p.x + Dx(f->r) > Dx(screen->r) ||
p.y + Dy(f->r) > screen->brect.min.y)
p = ZP;
}else {
area = LONG_MAX;
for(i=0; i < vp->n; i++) {
@ -146,7 +150,6 @@ float_placeframe(Frame *f) {
}
}
fr = rectsubpt(f->r, f->r.min);
f->r = rectaddpt(fr, p);
f->r = rectsetorigin(f->r, p);
}