aewl

diff draw.c @ 350:b10852dbbffe

3->4 colors
author Anselm R. Garbe <arg@10kloc.org>
date Thu, 24 Aug 2006 12:04:56 +0200
parents 977585eb2d35
children d822b5fbe11e
line diff
     1.1 --- a/draw.c	Thu Aug 24 10:28:50 2006 +0200
     1.2 +++ b/draw.c	Thu Aug 24 12:04:56 2006 +0200
     1.3 @@ -22,16 +22,15 @@
     1.4  }
     1.5  
     1.6  static void
     1.7 -drawtext(const char *text, Bool invert, Bool highlight)
     1.8 +drawtext(const char *text, unsigned int colidx, Bool highlight)
     1.9  {
    1.10  	int x, y, w, h;
    1.11  	static char buf[256];
    1.12  	unsigned int len, olen;
    1.13 -	XGCValues gcv;
    1.14  	XPoint points[5];
    1.15  	XRectangle r = { dc.x, dc.y, dc.w, dc.h };
    1.16  
    1.17 -	XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg);
    1.18 +	XSetForeground(dpy, dc.gc, dc.bg[colidx]);
    1.19  	XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
    1.20  	points[0].x = dc.x;
    1.21  	points[0].y = dc.y;
    1.22 @@ -43,7 +42,7 @@
    1.23  	points[3].y = 0;
    1.24  	points[4].x = 0;
    1.25  	points[4].y = -(dc.h - 1);
    1.26 -	XSetForeground(dpy, dc.gc, dc.border);
    1.27 +	XSetForeground(dpy, dc.gc, dc.fg[colidx]);
    1.28  	XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious);
    1.29  
    1.30  	if(!text)
    1.31 @@ -74,15 +73,10 @@
    1.32  
    1.33  	if(w > dc.w)
    1.34  		return; /* too long */
    1.35 -	gcv.foreground = invert ? dc.bg : dc.fg;
    1.36 -	gcv.background = invert ? dc.fg : dc.bg;
    1.37 -	if(dc.font.set) {
    1.38 -		XChangeGC(dpy, dc.gc, GCForeground | GCBackground, &gcv);
    1.39 +	if(dc.font.set)
    1.40  		XmbDrawString(dpy, dc.drawable, dc.font.set, dc.gc, x, y, buf, len);
    1.41 -	}
    1.42  	else {
    1.43 -		gcv.font = dc.font.xfont->fid;
    1.44 -		XChangeGC(dpy, dc.gc, GCForeground | GCBackground | GCFont, &gcv);
    1.45 +		XSetFont(dpy, dc.gc, dc.font.xfont->fid);
    1.46  		XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len);
    1.47  	}
    1.48  	if(highlight) {
    1.49 @@ -157,11 +151,11 @@
    1.50  	if(c == sel && issel) {
    1.51  		drawstatus();
    1.52  		XUnmapWindow(dpy, c->twin);
    1.53 -		XSetWindowBorder(dpy, c->win, dc.fg);
    1.54 +		XSetWindowBorder(dpy, c->win, dc.fg[1]);
    1.55  		return;
    1.56  	}
    1.57  
    1.58 -	XSetWindowBorder(dpy, c->win, dc.bg);
    1.59 +	XSetWindowBorder(dpy, c->win, dc.bg[0]);
    1.60  	XMapWindow(dpy, c->twin);
    1.61  	dc.x = dc.y = 0;
    1.62  	dc.w = c->tw;