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
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);

View File

@ -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);