simplified drawborder 67649463
Anselm R.Garbe · 2006-08-11 11:52 2 file(s) · +17 −23
config.mk +1 −1
1 1
# dmenu version
2 -
VERSION = 0.3
2 +
VERSION = 0.4
3 3
4 4
# Customize below to fit your system
5 5
draw.c +16 −22
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
{
50 30
	static char buf[256];
51 31
	unsigned int len;
52 32
	XGCValues gcv;
33 +
	XPoint points[5];
53 34
	XRectangle r = { dc.x, dc.y, dc.w, dc.h };
54 35
55 36
	XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg);
56 37
	XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
57 38
58 39
	w = 0;
59 -
	if(border)
60 -
		drawborder();
40 +
	if(border) {
41 +
		XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
42 +
		XSetForeground(dpy, dc.gc, dc.border);
43 +
		points[0].x = dc.x;
44 +
		points[0].y = dc.y;
45 +
		points[1].x = dc.w - 1;
46 +
		points[1].y = 0;
47 +
		points[2].x = 0;
48 +
		points[2].y = dc.h - 1;
49 +
		points[3].x = -(dc.w - 1);
50 +
		points[3].y = 0;
51 +
		points[4].x = 0;
52 +
		points[4].y = -(dc.h - 1);
53 +
		XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious);
54 +
	}
61 55
62 56
	if(!text)
63 57
		return;