diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-10-20 15:51:32 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-10-20 15:51:32 +0200 |
commit | 8057e48ae19db2f26f109aa3eb76c047b900e6ba (patch) | |
tree | cc9aa6d19fa35d28e7261b513a583eaf9b0a7835 /sys/src/cmd/rio/wind.c | |
parent | c33732a5305270321beccbd3e1b44881cd2e0004 (diff) |
rio: colors, flicker reduction, refresh after mouse close
allocate all the colors in iconinit(), remove unused ones
like grey. rename darkgrey to paletextcol because thats
what it is used for. new approach to window image allocation.
we allocate the window with DNofill and let the window fill
itself. this reduces flickering especially with (-b) option
and makes rio resize feel a lot faster.
wrefresh() didnt work. now fixed.
Diffstat (limited to 'sys/src/cmd/rio/wind.c')
-rw-r--r-- | sys/src/cmd/rio/wind.c | 50 |
1 files changed, 6 insertions, 44 deletions
diff --git a/sys/src/cmd/rio/wind.c b/sys/src/cmd/rio/wind.c index 337ed5bd2..259626486 100644 --- a/sys/src/cmd/rio/wind.c +++ b/sys/src/cmd/rio/wind.c @@ -21,21 +21,9 @@ enum MinWater = 20000, /* room to leave available when reallocating */ }; -extern int reverse; /* there are no pastel paints in the dungeons and dragons world -- rob pike */ - -static int topped; -static int id; - -static Image *cols[NCOL]; -static Image *grey; -static Image *darkgrey; +static int topped; +static int id; static Cursor *lastcursor; -static Image *titlecol; -static Image *lighttitlecol; -static Image *dholdcol; -static Image *holdcol; -static Image *lightholdcol; -static Image *paleholdcol; Window* wmk(Image *i, Mousectl *mc, Channel *ck, Channel *cctl, int scrolling) @@ -43,31 +31,6 @@ wmk(Image *i, Mousectl *mc, Channel *ck, Channel *cctl, int scrolling) Window *w; Rectangle r; - if(cols[0] == nil){ - /* greys are multiples of 0x11111100+0xFF, 14* being palest */ - grey = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0xEEEEEEFF^reverse); - darkgrey = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x666666FF^reverse); - cols[BACK] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0xFFFFFFFF^reverse); - cols[HIGH] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0xCCCCCCFF^reverse); - cols[BORD] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x999999FF); - cols[TEXT] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x000000FF^reverse); - cols[HTEXT] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x000000FF^reverse); - if(reverse == 0) { - titlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DGreygreen); - lighttitlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DPalegreygreen); - } else { - titlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DPurpleblue); - lighttitlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x666666FF^reverse); - } - dholdcol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DMedblue); - lightholdcol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DGreyblue); - paleholdcol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DPalegreyblue); - - if(reverse == 0) - holdcol = dholdcol; - else - holdcol = paleholdcol; - } w = emalloc(sizeof(Window)); w->screenr = i->r; r = insetrect(i->r, Selborder+1); @@ -162,16 +125,15 @@ wresize(Window *w, Image *i, int move) } void -wrefresh(Window *w, Rectangle) +wrefresh(Window *w, Rectangle r) { /* BUG: rectangle is ignored */ if(w == input) wborder(w, Selborder); else wborder(w, Unselborder); - if(w->mouseopen) - return; - draw(w->i, insetrect(w->i->r, Borderwidth), w->cols[BACK], nil, w->i->r.min); + r = insetrect(w->i->r, Selborder); + draw(w->i, r, w->cols[BACK], nil, w->entire.min); w->ticked = 0; if(w->p0 > 0) frdrawsel(w, frptofchar(w, 0), 0, w->p0, 0); @@ -760,7 +722,7 @@ wsetcols(Window *w) if(w == input) w->cols[TEXT] = w->cols[HTEXT] = cols[TEXT]; else - w->cols[TEXT] = w->cols[HTEXT] = darkgrey; + w->cols[TEXT] = w->cols[HTEXT] = paletextcol; } void |