about summary refs log tree commit diff stats
path: root/draw.c
diff options
context:
space:
mode:
Diffstat (limited to 'draw.c')
-rw-r--r--draw.c42
1 files changed, 16 insertions, 26 deletions
diff --git a/draw.c b/draw.c
index cbf6502..4ebda12 100644
--- a/draw.c
+++ b/draw.c
@@ -22,9 +22,17 @@ textnw(const char *text, unsigned int len)
 }
 
 static void
-drawborder()
+drawtext(const char *text, Bool invert, Bool underline)
 {
+	int x, y, w, h;
+	static char buf[256];
+	unsigned int len, olen;
+	XGCValues gcv;
 	XPoint points[5];
+	XRectangle r = { dc.x, dc.y, dc.w, dc.h };
+
+	XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg);
+	XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
 	points[0].x = dc.x;
 	points[0].y = dc.y;
 	points[1].x = dc.w - 1;
@@ -35,24 +43,8 @@ drawborder()
 	points[3].y = 0;
 	points[4].x = 0;
 	points[4].y = -(dc.h - 1);
-	XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious);
-}
-
-static void
-drawtext(const char *text, Bool invert, Bool highlight)
-{
-	int x, y, w, h;
-	static char buf[256];
-	unsigned int len, olen;
-	DC tmp;
-	XGCValues gcv;
-	XRectangle r = { dc.x, dc.y, dc.w, dc.h };
-
-	XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg);
-	XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
-	XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
 	XSetForeground(dpy, dc.gc, dc.border);
-	drawborder();
+	XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious);
 
 	if(!text)
 		return;
@@ -93,14 +85,12 @@ drawtext(const char *text, Bool invert, Bool highlight)
 		XChangeGC(dpy, dc.gc, GCForeground | GCBackground | GCFont, &gcv);
 		XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len);
 	}
-	if(highlight) {
-		tmp = dc;
-		dc.x += 2;
-		dc.y += 2;
-		dc.w -= 4;
-		dc.h -= 4;
-		drawborder();
-		dc = tmp;
+	if(underline) {
+		points[0].x = dc.x + (h / 2) - 1;
+		points[0].y = dc.y + dc.h - 3;
+		points[1].x = dc.w - h + 2;
+		points[1].y = 0;
+		XDrawLines(dpy, dc.drawable, dc.gc, points, 2, CoordModePrevious);
 	}
 }
 
298cc7fcf56517cb'>^
b1ad3a69 ^



2277b199 ^
b1ad3a69 ^
8419f31a ^
b1ad3a69 ^
8419f31a ^

2277b199 ^
8419f31a ^
2277b199 ^






b1ad3a69 ^

2277b199 ^




b1ad3a69 ^
2277b199 ^



da326ead ^
2277b199 ^
b1ad3a69 ^
2277b199 ^










b1ad3a69 ^
d526deb9 ^





2539db24 ^
8419f31a ^
d526deb9 ^
8419f31a ^







8419f31a ^
d526deb9 ^
















b1ad3a69 ^
136d8d9e ^
b1ad3a69 ^


d526deb9 ^
b1ad3a69 ^
d526deb9 ^
b1ad3a69 ^
d526deb9 ^
b1ad3a69 ^
d526deb9 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121