ref: c3867623ae93eca77ba6e4f3d851240442f02caf
parent: eeb96dca21dfc28afa69f3d00fa6f2cdb7e9b1b8
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Feb 13 11:36:24 EST 2016
rio: fix wrong frame colors when moving non-current window When a window is moved or reshaped, that implicitely tops the window and makes it current. The conseqence of this is that we always have to redraw the window as if it where a current window in any case. This was handled for Reshaped windows, but not when the window was just moved. We now handle both cases the exact same way, getting rid of the Moved wctl message.
--- a/sys/src/cmd/rio/dat.h
+++ b/sys/src/cmd/rio/dat.h
@@ -60,7 +60,6 @@
{
Wakeup,
Reshaped,
- Moved,
Topped,
Repaint,
Refresh,
@@ -210,9 +209,9 @@
void wpaste(Window*);
void wplumb(Window*);
void wlook(Window*);
-void wrefresh(Window*, Rectangle);
+void wrefresh(Window*);
void wrepaint(Window*);
-void wresize(Window*, Image*, int);
+void wresize(Window*, Image*);
void wscrdraw(Window*);
void wscroll(Window*, int);
void wselect(Window*);
--- a/sys/src/cmd/rio/rio.c
+++ b/sys/src/cmd/rio/rio.c
@@ -28,8 +28,7 @@
void newtile(int);
Image *sweep(void);
Image *bandsize(Window*);
-Image* drag(Window*, Rectangle*);
-void refresh(Rectangle);
+Image* drag(Window*);
void resized(void);
Channel *exitchan; /* chan(int) */
Channel *winclosechan; /* chan(Window*); */
@@ -457,7 +456,6 @@
int sending, inside, scrolling, moving, band;
Window *w, *winput;
Image *i;
- Rectangle r;
Point xy;
Mouse tmp;
enum {
@@ -546,13 +544,10 @@
if(band)
i = bandsize(winput);
else
- i = drag(winput, &r);
+ i = drag(winput);
sweeping = 0;
if(i != nil){
- if(band)
- wsendctlmesg(winput, Reshaped, i->r, i);
- else
- wsendctlmesg(winput, Moved, r, i);
+ wsendctlmesg(winput, Reshaped, i->r, i);
cornercursor(winput, mouse->xy, 1);
}
if(wclose(winput) == 0)
@@ -931,7 +926,7 @@
}
Image*
-drag(Window *w, Rectangle *rp)
+drag(Window *w)
{
Point p, op, d, dm, om;
Rectangle r;
@@ -964,7 +959,6 @@
readmouse(mousectl);
return nil;
}
- *rp = r;
return allocwindow(wscreen, r, Refbackup, DNofill);
}
@@ -1135,15 +1129,14 @@
{
Window *w;
Image *i;
- Rectangle r;
w = pointto(FALSE);
if(w == nil)
return;
incref(w);
- i = drag(w, &r);
+ i = drag(w);
if(i)
- wsendctlmesg(w, Moved, r, i);
+ wsendctlmesg(w, Reshaped, i->r, i);
cornercursor(w, mouse->xy, 1);
wclose(w);
}
--- a/sys/src/cmd/rio/wind.c
+++ b/sys/src/cmd/rio/wind.c
@@ -87,13 +87,10 @@
}
void
-wresize(Window *w, Image *i, int move)
+wresize(Window *w, Image *i)
{
- Rectangle r, or;
+ Rectangle r;
- or = w->i->r;
- if(move || (Dx(or)==Dx(i->r) && Dy(or)==Dy(i->r)))
- draw(i, i->r, w->i, nil, w->i->r.min);
freeimage(w->i);
w->i = i;
w->mc.image = i;
@@ -102,19 +99,15 @@
w->scrollr.max.x = r.min.x+Scrollwid;
w->lastsr = ZR;
r.min.x += Scrollwid+Scrollgap;
- if(move)
- frsetrects(w, r, w->i);
- else{
- frclear(w, FALSE);
- frinit(w, r, w->font, w->i, cols);
- wsetcols(w, 1);
- w->maxtab = maxtab*stringwidth(w->font, "0");
- r = insetrect(w->i->r, Selborder);
- draw(w->i, r, cols[BACK], nil, w->entire.min);
- wfill(w);
- wsetselect(w, w->q0, w->q1);
- wscrdraw(w);
- }
+ frclear(w, FALSE);
+ frinit(w, r, w->font, w->i, cols);
+ wsetcols(w, 1);
+ w->maxtab = maxtab*stringwidth(w->font, "0");
+ r = insetrect(w->i->r, Selborder);
+ draw(w->i, r, cols[BACK], nil, w->entire.min);
+ wfill(w);
+ wsetselect(w, w->q0, w->q1);
+ wscrdraw(w);
wborder(w, Selborder);
wsetname(w);
w->topped = ++topped;
@@ -124,9 +117,10 @@
}
void
-wrefresh(Window *w, Rectangle r)
+wrefresh(Window *w)
{
- /* BUG: rectangle is ignored */
+ Rectangle r;
+
if(w == input)
wborder(w, Selborder);
else
@@ -1127,7 +1121,6 @@
if(p!=nil)
sendp((Channel*)p, w);
break;
- case Moved:
case Reshaped:
if(w->deleted){
freeimage(i);
@@ -1135,7 +1128,7 @@
}
w->screenr = r;
strcpy(buf, w->name);
- wresize(w, i, m==Moved);
+ wresize(w, i);
proccreate(deletetimeoutproc, estrdup(buf), 4096);
flushimage(display, 1);
if(Dx(r)<=0){ /* window got hidden, if we had the input, drop it */
@@ -1189,9 +1182,9 @@
flushimage(display, 1);
break;
case Refresh:
- if(w->i==nil || Dx(w->screenr)<=0 || !rectclip(&r, w->i->r) || w->mouseopen)
+ if(w->i==nil || Dx(w->screenr)<=0 || w->mouseopen)
break;
- wrefresh(w, r);
+ wrefresh(w);
flushimage(display, 1);
break;
case Movemouse: