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.
This commit is contained in:
cinap_lenrek 2016-02-13 16:36:24 +01:00
parent eeb96dca21
commit c3867623ae
3 changed files with 25 additions and 40 deletions

View file

@ -60,7 +60,6 @@ enum /* control messages */
{
Wakeup,
Reshaped,
Moved,
Topped,
Repaint,
Refresh,
@ -210,9 +209,9 @@ void wmovemouse(Window*, Point);
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*);

View file

@ -28,8 +28,7 @@ void unhide(int);
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 @@ mousethread(void*)
int sending, inside, scrolling, moving, band;
Window *w, *winput;
Image *i;
Rectangle r;
Point xy;
Mouse tmp;
enum {
@ -546,13 +544,10 @@ mousethread(void*)
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 @@ drawborder(Rectangle r, int show)
}
Image*
drag(Window *w, Rectangle *rp)
drag(Window *w)
{
Point p, op, d, dm, om;
Rectangle r;
@ -964,7 +959,6 @@ drag(Window *w, Rectangle *rp)
readmouse(mousectl);
return nil;
}
*rp = r;
return allocwindow(wscreen, r, Refbackup, DNofill);
}
@ -1135,15 +1129,14 @@ move(void)
{
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);
}

View file

@ -87,13 +87,10 @@ wsetname(Window *w)
}
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 @@ wresize(Window *w, Image *i, int move)
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 @@ wresize(Window *w, Image *i, int move)
}
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 @@ wctlmesg(Window *w, int m, Rectangle r, void *p)
if(p!=nil)
sendp((Channel*)p, w);
break;
case Moved:
case Reshaped:
if(w->deleted){
freeimage(i);
@ -1135,7 +1128,7 @@ wctlmesg(Window *w, int m, Rectangle r, void *p)
}
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 @@ wctlmesg(Window *w, int m, Rectangle r, void *p)
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: