diff --git a/sys/src/cmd/rio/rio.c b/sys/src/cmd/rio/rio.c index 9b3f70522..ea4420859 100644 --- a/sys/src/cmd/rio/rio.c +++ b/sys/src/cmd/rio/rio.c @@ -655,12 +655,56 @@ resized(void) flushimage(display, 1); } +static int +wcovered(Window *w, Rectangle r) +{ + Window *t; + int i; + + for(i=0; itopped <= w->topped || t->deleted) + continue; + if(Dx(t->screenr) == 0 || Dy(t->screenr) == 0 || rectXrect(r, t->screenr) == 0) + continue; + 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))) + return 0; + 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))) + return 0; + 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))) + return 0; + 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))) + return 0; + return 1; + } + return 0; +} + void button3menu(void) { - int i; + int i, j, n; - for(i=0; ideleted) + continue; + if(wcovered(window[i], window[i]->screenr)){ + hidden[n++] = window[i]; + if(n >= nelem(hidden)) + break; + } + } + if(n >= nelem(menu3str)-Hidden) + n = nelem(menu3str)-Hidden-1; + for(i=0; ilabel; menu3str[i+Hidden] = nil; @@ -1090,6 +1134,8 @@ whide(Window *w) for(j=0; j