rio: add some tolerance when declaring windows covered

This commit is contained in:
cinap_lenrek 2012-08-16 06:32:34 +02:00
parent 2eb369bb1d
commit 711557c85e

View file

@ -656,28 +656,29 @@ resized(void)
} }
static int static int
wcovered(Window *w, Rectangle r) wcovered(Window *w, Rectangle r, int i)
{ {
Window *t; Window *t;
int i;
for(i=0; i<nwindow; i++){ if(Dx(r) < font->height || Dy(r) < font->height)
return 1;
for(; i<nwindow; i++){
t = window[i]; t = window[i];
if(t == w || t->topped <= w->topped || t->deleted) if(t == w || t->topped <= w->topped || t->deleted)
continue; continue;
if(Dx(t->screenr) == 0 || Dy(t->screenr) == 0 || rectXrect(r, t->screenr) == 0) if(Dx(t->screenr) == 0 || Dy(t->screenr) == 0 || rectXrect(r, t->screenr) == 0)
continue; continue;
if(r.min.y < t->screenr.min.y) if(r.min.y < t->screenr.min.y)
if(!wcovered(w, Rect(r.min.x, r.min.y, r.max.x, t->screenr.min.y))) if(!wcovered(w, Rect(r.min.x, r.min.y, r.max.x, t->screenr.min.y), i))
return 0; return 0;
if(r.min.x < t->screenr.min.x) if(r.min.x < t->screenr.min.x)
if(!wcovered(w, Rect(r.min.x, r.min.y, t->screenr.min.x, r.max.y))) if(!wcovered(w, Rect(r.min.x, r.min.y, t->screenr.min.x, r.max.y), i))
return 0; return 0;
if(r.max.y > t->screenr.max.y) if(r.max.y > t->screenr.max.y)
if(!wcovered(w, Rect(r.min.x, t->screenr.max.y, r.max.x, r.max.y))) if(!wcovered(w, Rect(r.min.x, t->screenr.max.y, r.max.x, r.max.y), i))
return 0; return 0;
if(r.max.x > t->screenr.max.x) if(r.max.x > t->screenr.max.x)
if(!wcovered(w, Rect(t->screenr.max.x, r.min.y, r.max.x, r.max.y))) if(!wcovered(w, Rect(t->screenr.max.x, r.min.y, r.max.x, r.max.y), i))
return 0; return 0;
return 1; return 1;
} }
@ -696,7 +697,7 @@ button3menu(void)
break; break;
if(i < n || window[i]->deleted) if(i < n || window[i]->deleted)
continue; continue;
if(wcovered(window[i], window[i]->screenr)){ if(wcovered(window[i], window[i]->screenr, 0)){
hidden[n++] = window[i]; hidden[n++] = window[i];
if(n >= nelem(hidden)) if(n >= nelem(hidden))
break; break;