aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnselm R.Garbe <arg@10ksloc.org>2006-08-11 11:52:34 +0200
committerAnselm R.Garbe <arg@10ksloc.org>2006-08-11 11:52:34 +0200
commit67649463c802d68fa2c5c9dbece8aba3a2ca9d9a (patch)
treeb43a7a42134f7bbe102c7d409c29a6ae3bf35e94
parentd1415ea4970cba350d9d4af5c8699e9278899707 (diff)
simplified drawborder
-rw-r--r--config.mk2
-rw-r--r--draw.c38
2 files changed, 17 insertions, 23 deletions
diff --git a/config.mk b/config.mk
index 572d192..cc19e19 100644
--- a/config.mk
+++ b/config.mk
@@ -1,5 +1,5 @@
1# dmenu version 1# dmenu version
2VERSION = 0.3 2VERSION = 0.4
3 3
4# Customize below to fit your system 4# Customize below to fit your system
5 5
diff --git a/draw.c b/draw.c
index 7507595..383e130 100644
--- a/draw.c
+++ b/draw.c
@@ -9,26 +9,6 @@
9 9
10/* static */ 10/* static */
11 11
12static void
13drawborder(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
32static unsigned int 12static unsigned int
33textnw(const char *text, unsigned int len) 13textnw(const char *text, unsigned int len)
34{ 14{
@@ -50,14 +30,28 @@ drawtext(const char *text, Bool invert, Bool border)
50 static char buf[256]; 30 static char buf[256];
51 unsigned int len; 31 unsigned int len;
52 XGCValues gcv; 32 XGCValues gcv;
33 XPoint points[5];
53 XRectangle r = { dc.x, dc.y, dc.w, dc.h }; 34 XRectangle r = { dc.x, dc.y, dc.w, dc.h };
54 35
55 XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg); 36 XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg);
56 XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); 37 XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
57 38
58 w = 0; 39 w = 0;
59 if(border) 40 if(border) {
60 drawborder(); 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 if(!text) 56 if(!text)
63 return; 57 return;