diff options
| -rw-r--r-- | config.mk | 2 | ||||
| -rw-r--r-- | draw.c | 38 |
2 files changed, 17 insertions, 23 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | # dmenu version | 1 | # dmenu version |
| 2 | VERSION = 0.3 | 2 | VERSION = 0.4 |
| 3 | 3 | ||
| 4 | # Customize below to fit your system | 4 | # Customize below to fit your system |
| 5 | 5 | ||
| @@ -9,26 +9,6 @@ | |||
| 9 | 9 | ||
| 10 | /* static */ | 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 | static unsigned int | 12 | static unsigned int |
| 33 | textnw(const char *text, unsigned int len) | 13 | textnw(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; |
