Fix some bugs related to windows which automagically float, and subsequent actions.

This commit is contained in:
Kris Maglione 2008-09-15 19:30:47 -04:00
parent 81d63271d1
commit e99f8a8a58
2 changed files with 17 additions and 6 deletions

View File

@ -24,12 +24,13 @@ float_attach(Area *a, Frame *f) {
void void
float_detach(Frame *f) { float_detach(Frame *f) {
Frame *pr; Frame *pr;
Area *a, *sel; Area *a, *sel, *oldsel;
View *v; View *v;
v = f->view; v = f->view;
a = f->area; a = f->area;
sel = view_findarea(v, v->selcol, false); sel = view_findarea(v, v->selcol, false);
oldsel = v->oldsel;
if(!(sel || !v->area->next)) warning("%s:%d: !(sel || !v->area->next)", __FILE__, __LINE__); if(!(sel || !v->area->next)) warning("%s:%d: !(sel || !v->area->next)", __FILE__, __LINE__);
pr = f->aprev; pr = f->aprev;
@ -43,8 +44,8 @@ float_detach(Frame *f) {
} }
f->area = nil; f->area = nil;
if(v->oldsel) if(oldsel)
area_focus(v->oldsel); area_focus(oldsel);
else if(!a->frame) else if(!a->frame)
if(sel && sel->frame) if(sel && sel->frame)
area_focus(sel); area_focus(sel);

View File

@ -300,20 +300,27 @@ void
view_attach(View *v, Frame *f) { view_attach(View *v, Frame *f) {
Client *c; Client *c;
Frame *ff; Frame *ff;
Area *a; Area *a, *oldsel;
c = f->client; c = f->client;
oldsel = nil;
a = v->sel; a = v->sel;
if(client_floats_p(c)) { if(client_floats_p(c)) {
if(v->sel != v->area) if(v->sel != v->area)
v->oldsel = v->sel; oldsel = v->sel;
a = v->area; a = v->area;
} }
else if((ff = client_groupframe(c, v))) else if((ff = client_groupframe(c, v)))
a = ff->area; a = ff->area;
else if(v->sel->floating) { 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; a = v->area->next;
} }
@ -332,6 +339,9 @@ view_attach(View *v, Frame *f) {
area_setsel(f->area, f); area_setsel(f->area, f);
} }
if(oldsel)
v->oldsel = oldsel;
if(c->sel == nil) if(c->sel == nil)
c->sel = f; c->sel = f;
view_update(v); view_update(v);