aewl

diff draw.c @ 257:32dc3acfffc0

simplified drawtext
author Anselm R.Garbe <arg@10ksloc.org>
date Fri, 11 Aug 2006 11:52:55 +0200
parents e5390f8e06b9
children d6fd632d861c
line diff
     1.1 --- a/draw.c	Fri Aug 11 10:54:29 2006 +0200
     1.2 +++ b/draw.c	Fri Aug 11 11:52:55 2006 +0200
     1.3 @@ -9,26 +9,6 @@
     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 @@ -48,11 +28,24 @@
    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 +	XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
    1.41 +	XSetForeground(dpy, dc.gc, dc.border);
    1.42 +	points[0].x = dc.x;
    1.43 +	points[0].y = dc.y;
    1.44 +	points[1].x = dc.w - 1;
    1.45 +	points[1].y = 0;
    1.46 +	points[2].x = 0;
    1.47 +	points[2].y = dc.h - 1;
    1.48 +	points[3].x = -(dc.w - 1);
    1.49 +	points[3].y = 0;
    1.50 +	points[4].x = 0;
    1.51 +	points[4].y = -(dc.h - 1);
    1.52 +	XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious);
    1.53  
    1.54  	if(!text)
    1.55  		return;