wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit ffed6038306c0b1b1eb6a72b12a145ec0e707464
parent 8726fc4692c42bc1dac4c8307b0767d51c2d5178
Author: Kris Maglione <jg@suckless.org>
Date:   Sun, 19 Oct 2008 12:32:46 -0400

Fix some fullscreen-restoration bugs

Diffstat:
cmd/wmii/area.c | 4+---
cmd/wmii/column.c | 46++++++++++++++++------------------------------
2 files changed, 17 insertions(+), 33 deletions(-)

diff --git a/cmd/wmii/area.c b/cmd/wmii/area.c @@ -176,7 +176,6 @@ area_destroy(Area *a) { void area_moveto(Area *to, Frame *f) { Area *from; - bool fromfloating; assert(to->view == f->view); @@ -184,13 +183,12 @@ area_moveto(Area *to, Frame *f) { return; from = f->area; - fromfloating = from->floating; area_detach(f); /* Temporary kludge. */ if(!to->floating - && to->floating != fromfloating + && to->floating != from->floating && !eqrect(f->colr, ZR)) column_attachrect(to, f, f->colr); else diff --git a/cmd/wmii/column.c b/cmd/wmii/column.c @@ -200,6 +200,8 @@ column_detach(Frame *f) { a = f->area; stack_info(f, &first, &dy, nil); + if(first && first == f) + first = f->anext; column_remove(f); if(a->frame) { if(first) @@ -220,8 +222,6 @@ column_attachrect(Area *a, Frame *f, Rectangle r) { for(fp=a->frame; fp; pos=fp, fp=fp->anext) { if(r.max.y < fp->r.min.y) continue; - if(r.min.x > fp->r.max.y) - continue; before = fp->r.min.y - r.min.y; after = r.max.y - fp->r.max.y; if(abs(before) <= abs(after)) @@ -234,11 +234,7 @@ column_attachrect(Area *a, Frame *f, Rectangle r) { a->r.max.y += Dy(r); } column_insert(a, f, pos); - for(fp=f->anext; fp; fp=fp->anext) { - fp->r.min.y += Dy(r); - fp->r.max.y += Dy(r); - } - column_resizeframe(f, r); + column_scale(a); } void @@ -306,10 +302,7 @@ column_fit(Area *a, uint *ncolp, uint *nuncolp) { if(nuncol == 0) { nuncol++; ncol--; - if(a->sel) - a->sel->collapsed = false; - else - a->frame->collapsed = false; + (a->sel ? a->sel : a->frame)->collapsed = false; } /* FIXME: Kludge. */ @@ -421,29 +414,24 @@ foo(Frame *f) { h.aspect.max.y / h.aspect.max.x; maxh = max(maxh, h.max.y); - if(Dy(f->r) > maxh) + if(Dy(f->r) >= maxh) return 0; return h.inc.y - (Dy(f->r) - h.base.y) % h.inc.y; } static int comp_frame(const void *a, const void *b) { - Frame *fa, *fb; int ia, ib; - fa = *(Frame**)a; - fb = *(Frame**)b; - ia = foo(fa); - ib = foo(fb); - return ia < ib ? -1 : - ia > ib ? 1 : - /* Favor the selected client. */ - /* No... don't. Windows shouldn't jump when the mouse - * enters them. - fa == fa->area->sel ? -1 : - fb == fa->area->sel ? 1 : - */ - 0; + ia = foo(*(Frame**)a); + ib = foo(*(Frame**)b); + /* + * I'd like to favor the selected client, but + * it causes windows to jump as focus changes. + */ + return ia < ib ? -1 : + ia > ib ? 1 : + 0; } static void @@ -515,7 +503,7 @@ column_scale(Area *a) { dy += Dy(f->colr); } for(f=a->frame; f; f=f->anext) { - f->dy = Dy(f->r); + f->dy = Dy(f->colr); f->colr.min.x = a->r.min.x; f->colr.max.x = a->r.max.x; if(!f->collapsed) @@ -633,10 +621,8 @@ column_resizeframe(Frame *f, Rectangle r) { minw = Dx(v->r[a->screen]) / NCOL; - ar = a->next; al = a->prev; - if(al == v->floating) - al = nil; + ar = a->next; if(al) r.min.x = max(r.min.x, al->r.min.x + minw);