aewl

diff draw.c @ 237:7f8f7f14e9cd

readded border color, this sucks least
author Anselm R.Garbe <arg@10ksloc.org>
date Thu, 10 Aug 2006 11:12:15 +0200
parents ebecb98a1c29
children e5390f8e06b9
line diff
     1.1 --- a/draw.c	Thu Aug 10 11:07:27 2006 +0200
     1.2 +++ b/draw.c	Thu Aug 10 11:12:15 2006 +0200
     1.3 @@ -9,6 +9,26 @@
     1.4  
     1.5  /* static */
     1.6  
     1.7 +static void
     1.8 +drawborder(void)
     1.9 +{
    1.10 +	XPoint points[5];
    1.11 +
    1.12 +	XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
    1.13 +	XSetForeground(dpy, dc.gc, dc.border);
    1.14 +	points[0].x = dc.x;
    1.15 +	points[0].y = dc.y;
    1.16 +	points[1].x = dc.w - 1;
    1.17 +	points[1].y = 0;
    1.18 +	points[2].x = 0;
    1.19 +	points[2].y = dc.h - 1;
    1.20 +	points[3].x = -(dc.w - 1);
    1.21 +	points[3].y = 0;
    1.22 +	points[4].x = 0;
    1.23 +	points[4].y = -(dc.h - 1);
    1.24 +	XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious);
    1.25 +}
    1.26 +
    1.27  static unsigned int
    1.28  textnw(const char *text, unsigned int len)
    1.29  {
    1.30 @@ -28,11 +48,12 @@
    1.31  	static char buf[256];
    1.32  	unsigned int len;
    1.33  	XGCValues gcv;
    1.34 -	XPoint points[5];
    1.35  	XRectangle r = { dc.x, dc.y, dc.w, dc.h };
    1.36  
    1.37  	XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg);
    1.38  	XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
    1.39 +	drawborder();
    1.40 +
    1.41  	if(!text)
    1.42  		return;
    1.43  
    1.44 @@ -66,19 +87,6 @@
    1.45  		XChangeGC(dpy, dc.gc, GCForeground | GCBackground | GCFont, &gcv);
    1.46  		XDrawImageString(dpy, dc.drawable, dc.gc, x, y, buf, len);
    1.47  	}
    1.48 -
    1.49 -	XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
    1.50 -	points[0].x = dc.x;
    1.51 -	points[0].y = dc.y;
    1.52 -	points[1].x = dc.w - 1;
    1.53 -	points[1].y = 0;
    1.54 -	points[2].x = 0;
    1.55 -	points[2].y = dc.h - 1;
    1.56 -	points[3].x = -(dc.w - 1);
    1.57 -	points[3].y = 0;
    1.58 -	points[4].x = 0;
    1.59 -	points[4].y = -(dc.h - 1);
    1.60 -	XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious);
    1.61  }
    1.62  
    1.63  /* extern */