aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.arg.h1
-rw-r--r--config.default.h1
-rw-r--r--dmenu.h3
-rw-r--r--draw.c25
-rw-r--r--main.c11
5 files changed, 7 insertions, 34 deletions
diff --git a/config.arg.h b/config.arg.h
index c5e1874..30c422d 100644
--- a/config.arg.h
+++ b/config.arg.h
@@ -6,4 +6,3 @@
6#define FONT "-*-terminus-medium-*-*-*-12-*-*-*-*-*-iso10646-*" 6#define FONT "-*-terminus-medium-*-*-*-12-*-*-*-*-*-iso10646-*"
7#define BGCOLOR "#eeeeee" 7#define BGCOLOR "#eeeeee"
8#define FGCOLOR "#666699" 8#define FGCOLOR "#666699"
9#define BORDERCOLOR "#9999CC"
diff --git a/config.default.h b/config.default.h
index cf1baea..0b1abb4 100644
--- a/config.default.h
+++ b/config.default.h
@@ -6,4 +6,3 @@
6#define FONT "fixed" 6#define FONT "fixed"
7#define BGCOLOR "#666699" 7#define BGCOLOR "#666699"
8#define FGCOLOR "#eeeeee" 8#define FGCOLOR "#eeeeee"
9#define BORDERCOLOR "#9999CC"
diff --git a/dmenu.h b/dmenu.h
index 2a8796f..f118196 100644
--- a/dmenu.h
+++ b/dmenu.h
@@ -24,7 +24,6 @@ struct DC { /* draw context */
24 int x, y, w, h; 24 int x, y, w, h;
25 unsigned long bg; 25 unsigned long bg;
26 unsigned long fg; 26 unsigned long fg;
27 unsigned long border;
28 Drawable drawable; 27 Drawable drawable;
29 Fnt font; 28 Fnt font;
30 GC gc; 29 GC gc;
@@ -35,7 +34,7 @@ extern Display *dpy;
35extern DC dc; 34extern DC dc;
36 35
37/* draw.c */ 36/* draw.c */
38extern void drawtext(const char *text, Bool invert, Bool border); 37extern void drawtext(const char *text, Bool invert);
39extern unsigned long getcolor(const char *colstr); 38extern unsigned long getcolor(const char *colstr);
40extern void setfont(const char *fontstr); 39extern void setfont(const char *fontstr);
41extern unsigned int textw(const char *text); 40extern unsigned int textw(const char *text);
diff --git a/draw.c b/draw.c
index 7507595..4e079e5 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{
@@ -44,7 +24,7 @@ textnw(const char *text, unsigned int len)
44/* extern */ 24/* extern */
45 25
46void 26void
47drawtext(const char *text, Bool invert, Bool border) 27drawtext(const char *text, Bool invert)
48{ 28{
49 int x, y, w, h; 29 int x, y, w, h;
50 static char buf[256]; 30 static char buf[256];
@@ -54,10 +34,7 @@ drawtext(const char *text, Bool invert, Bool border)
54 34
55 XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg); 35 XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg);
56 XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); 36 XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
57
58 w = 0; 37 w = 0;
59 if(border)
60 drawborder();
61 38
62 if(!text) 39 if(!text)
63 return; 40 return;
diff --git a/main.c b/main.c
index 3b9a24b..14581c4 100644
--- a/main.c
+++ b/main.c
@@ -77,17 +77,17 @@ drawmenu()
77 dc.y = 0; 77 dc.y = 0;
78 dc.w = mw; 78 dc.w = mw;
79 dc.h = mh; 79 dc.h = mh;
80 drawtext(NULL, False, False); 80 drawtext(NULL, False);
81 81
82 /* print command */ 82 /* print command */
83 if(cmdw && item) 83 if(cmdw && item)
84 dc.w = cmdw; 84 dc.w = cmdw;
85 drawtext(text[0] ? text : NULL, False, False); 85 drawtext(text[0] ? text : NULL, False);
86 dc.x += cmdw; 86 dc.x += cmdw;
87 87
88 if(curr) { 88 if(curr) {
89 dc.w = SPACE; 89 dc.w = SPACE;
90 drawtext((curr && curr->left) ? "<" : NULL, False, False); 90 drawtext((curr && curr->left) ? "<" : NULL, False);
91 dc.x += dc.w; 91 dc.x += dc.w;
92 92
93 /* determine maximum items */ 93 /* determine maximum items */
@@ -95,13 +95,13 @@ drawmenu()
95 dc.w = textw(i->text); 95 dc.w = textw(i->text);
96 if(dc.w > mw / 3) 96 if(dc.w > mw / 3)
97 dc.w = mw / 3; 97 dc.w = mw / 3;
98 drawtext(i->text, sel == i, sel == i); 98 drawtext(i->text, sel == i);
99 dc.x += dc.w; 99 dc.x += dc.w;
100 } 100 }
101 101
102 dc.x = mw - SPACE; 102 dc.x = mw - SPACE;
103 dc.w = SPACE; 103 dc.w = SPACE;
104 drawtext(next ? ">" : NULL, False, False); 104 drawtext(next ? ">" : NULL, False);
105 } 105 }
106 XCopyArea(dpy, dc.drawable, win, dc.gc, 0, 0, mw, mh, 0, 0); 106 XCopyArea(dpy, dc.drawable, win, dc.gc, 0, 0, mw, mh, 0, 0);
107 XFlush(dpy); 107 XFlush(dpy);
@@ -316,7 +316,6 @@ main(int argc, char *argv[])
316 /* style */ 316 /* style */
317 dc.bg = getcolor(BGCOLOR); 317 dc.bg = getcolor(BGCOLOR);
318 dc.fg = getcolor(FGCOLOR); 318 dc.fg = getcolor(FGCOLOR);
319 dc.border = getcolor(BORDERCOLOR);
320 setfont(FONT); 319 setfont(FONT);
321 320
322 wa.override_redirect = 1; 321 wa.override_redirect = 1;