diff --git a/sys/src/cmd/rio/rio.c b/sys/src/cmd/rio/rio.c index c715f22ca..1a1c54002 100644 --- a/sys/src/cmd/rio/rio.c +++ b/sys/src/cmd/rio/rio.c @@ -964,7 +964,7 @@ drag(Window *w) p = mouse->xy; riosetcursor(inborder(r, p) ? corners[whichcorner(r, p)] : nil); menuing = FALSE; - if(mouse->buttons!=0 || !goodrect(r) || eqrect(r, screen->r)){ + if(mouse->buttons!=0 || !goodrect(r) || eqrect(r, w->screenr)){ flushimage(display, 1); while(mouse->buttons) readmouse(mousectl); diff --git a/sys/src/cmd/rio/wind.c b/sys/src/cmd/rio/wind.c index f29fb6a43..fd86a6643 100644 --- a/sys/src/cmd/rio/wind.c +++ b/sys/src/cmd/rio/wind.c @@ -1099,7 +1099,7 @@ wsendctlmesg(Window *w, int type, Rectangle r, void *p) int wctlmesg(Window *w, int m, Rectangle r, void *p) { - char buf[64]; + char *oldname; Image *i = p; switch(m){ @@ -1115,10 +1115,10 @@ wctlmesg(Window *w, int m, Rectangle r, void *p) freeimage(i); break; } + oldname = estrdup(w->name); w->screenr = r; - strcpy(buf, w->name); wresize(w, i); - proccreate(deletetimeoutproc, estrdup(buf), 4096); + proccreate(deletetimeoutproc, oldname, 4096); if(Dx(r)<=0){ /* window got hidden, if we had the input, drop it */ if(w==input) input = nil; @@ -1157,8 +1157,10 @@ wctlmesg(Window *w, int m, Rectangle r, void *p) wsendctlmesg(oi, Repaint, ZR, nil); } wclose(oi); - } else + } else { input = w; + wsetcursor(w, FALSE); + } w->wctlready = 1; if(m!=Topped && w==input) break; @@ -1295,16 +1297,15 @@ wsetcursor(Window *w, int force) if(menuing || sweeping) return; - if(w==nil || w->i==nil || Dx(w->screenr)<=0) + if(w==nil || Dx(w->screenr)<=0 || wpointto(mouse->xy)!=w) p = nil; - else if(wpointto(mouse->xy) == w){ + else { p = w->cursorp; if(p==nil && w->holding) p = &whitearrow; - }else - p = nil; - if(force) /* force cursor reload */ - lastcursor = (void*)~0; + } + if(p && force) /* force cursor reload */ + lastcursor = nil; riosetcursor(p); } @@ -1373,7 +1374,7 @@ wclunk(Window *w) w->deleted = TRUE; if(w == input){ input = nil; - wsetcursor(w, FALSE); + riosetcursor(nil); } if(w == wkeyboard) wkeyboard = nil; diff --git a/sys/src/cmd/rio/xfid.c b/sys/src/cmd/rio/xfid.c index bd0f42ffb..47100a5e2 100644 --- a/sys/src/cmd/rio/xfid.c +++ b/sys/src/cmd/rio/xfid.c @@ -333,7 +333,8 @@ xfidclose(Xfid *x) break; case Qcursor: w->cursorp = nil; - wsetcursor(w, FALSE); + if(w==input) + wsetcursor(w, FALSE); break; case Qkbd: w->kbdopen = FALSE; @@ -478,7 +479,8 @@ xfidwrite(Xfid *x) memmove(w->cursor.clr, x->data+2*4, 2*2*16); w->cursorp = &w->cursor; } - wsetcursor(w, !sweeping && !menuing); + if(w==input) + wsetcursor(w, TRUE); break; case Qlabel: