From e99f8a8a583ef34e2f01756fda4cd03907122ae3 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 15 Sep 2008 19:30:47 -0400 Subject: [PATCH] Fix some bugs related to windows which automagically float, and subsequent actions. --- cmd/wmii/float.c | 7 ++++--- cmd/wmii/view.c | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/cmd/wmii/float.c b/cmd/wmii/float.c index c1e302b0..ce51fef4 100644 --- a/cmd/wmii/float.c +++ b/cmd/wmii/float.c @@ -24,12 +24,13 @@ float_attach(Area *a, Frame *f) { void float_detach(Frame *f) { Frame *pr; - Area *a, *sel; + Area *a, *sel, *oldsel; View *v; v = f->view; a = f->area; sel = view_findarea(v, v->selcol, false); + oldsel = v->oldsel; if(!(sel || !v->area->next)) warning("%s:%d: !(sel || !v->area->next)", __FILE__, __LINE__); pr = f->aprev; @@ -43,8 +44,8 @@ float_detach(Frame *f) { } f->area = nil; - if(v->oldsel) - area_focus(v->oldsel); + if(oldsel) + area_focus(oldsel); else if(!a->frame) if(sel && sel->frame) area_focus(sel); diff --git a/cmd/wmii/view.c b/cmd/wmii/view.c index 104f5363..aff375d2 100644 --- a/cmd/wmii/view.c +++ b/cmd/wmii/view.c @@ -300,20 +300,27 @@ void view_attach(View *v, Frame *f) { Client *c; Frame *ff; - Area *a; + Area *a, *oldsel; c = f->client; + oldsel = nil; a = v->sel; if(client_floats_p(c)) { if(v->sel != v->area) - v->oldsel = v->sel; + oldsel = v->sel; a = v->area; } else if((ff = client_groupframe(c, v))) a = ff->area; else if(v->sel->floating) { - if(starting || c->sel && c->sel->area && !c->sel->area->floating) + if(v->oldsel) + a = v->oldsel; + /* Don't float a frame when starting or when its + * last focused frame didn't float. Important when + * tagging with +foo. + */ + else if(starting || c->sel && c->sel->area && !c->sel->area->floating) a = v->area->next; } @@ -332,6 +339,9 @@ view_attach(View *v, Frame *f) { area_setsel(f->area, f); } + if(oldsel) + v->oldsel = oldsel; + if(c->sel == nil) c->sel = f; view_update(v);