simplified drawtext 975b459c
Anselm R.Garbe · 2006-08-11 11:52 1 file(s) · +14 −21
draw.c +14 −21
9 9
10 10
/* static */
11 11
12 -
static void
13 -
drawborder(void)
14 -
{
15 -
	XPoint points[5];
16 -
17 -
	XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
18 -
	XSetForeground(dpy, dc.gc, dc.border);
19 -
	points[0].x = dc.x;
20 -
	points[0].y = dc.y;
21 -
	points[1].x = dc.w - 1;
22 -
	points[1].y = 0;
23 -
	points[2].x = 0;
24 -
	points[2].y = dc.h - 1;
25 -
	points[3].x = -(dc.w - 1);
26 -
	points[3].y = 0;
27 -
	points[4].x = 0;
28 -
	points[4].y = -(dc.h - 1);
29 -
	XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious);
30 -
}
31 -
32 12
static unsigned int
33 13
textnw(const char *text, unsigned int len)
34 14
{
48 28
	static char buf[256];
49 29
	unsigned int len;
50 30
	XGCValues gcv;
31 +
	XPoint points[5];
51 32
	XRectangle r = { dc.x, dc.y, dc.w, dc.h };
52 33
53 34
	XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg);
54 35
	XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
55 -
	drawborder();
36 +
	XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
37 +
	XSetForeground(dpy, dc.gc, dc.border);
38 +
	points[0].x = dc.x;
39 +
	points[0].y = dc.y;
40 +
	points[1].x = dc.w - 1;
41 +
	points[1].y = 0;
42 +
	points[2].x = 0;
43 +
	points[2].y = dc.h - 1;
44 +
	points[3].x = -(dc.w - 1);
45 +
	points[3].y = 0;
46 +
	points[4].x = 0;
47 +
	points[4].y = -(dc.h - 1);
48 +
	XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious);
56 49
57 50
	if(!text)
58 51
		return;