diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-05-14 18:14:08 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-05-14 18:14:08 +0200 |
commit | 81f867f4fb3d7fd495be3282a01d2e4a9b1a56fd (patch) | |
tree | 7131790858f57c3a7758dc150e50f2cae833b2ec /sys/src/cmd/rio/wind.c | |
parent | 06a0dc5319435aa6d6e1152a789fb9d7dcba98de (diff) |
rio: only the current window may change the cursor, fix typo screen->r vs w->screenr in drag()
Diffstat (limited to 'sys/src/cmd/rio/wind.c')
-rw-r--r-- | sys/src/cmd/rio/wind.c | 23 |
1 files changed, 12 insertions, 11 deletions
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; |