readded border color, this sucks least
00255728
5 file(s) · +26 −14
| 11 | 11 | #define FONT "-*-terminus-medium-*-*-*-12-*-*-*-*-*-iso10646-*" |
|
| 12 | 12 | #define BGCOLOR "#eeeeee" |
|
| 13 | 13 | #define FGCOLOR "#666699" |
|
| 14 | + | #define BORDERCOLOR "#9999CC" |
|
| 14 | 15 | #define MODKEY Mod1Mask |
|
| 15 | 16 | #define NUMLOCKMASK Mod2Mask |
|
| 16 | 17 | #define MASTERW 60 /* percent */ |
| 11 | 11 | #define FONT "fixed" |
|
| 12 | 12 | #define BGCOLOR "#666699" |
|
| 13 | 13 | #define FGCOLOR "#eeeeee" |
|
| 14 | + | #define BORDERCOLOR "#9999CC" |
|
| 14 | 15 | #define MODKEY Mod1Mask |
|
| 15 | 16 | #define NUMLOCKMASK Mod2Mask |
|
| 16 | 17 | #define MASTERW 60 /* percent */ |
| 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 | + | ||
| 12 | 32 | static unsigned int |
|
| 13 | 33 | textnw(const char *text, unsigned int len) |
|
| 14 | 34 | { |
|
| 28 | 48 | static char buf[256]; |
|
| 29 | 49 | unsigned int len; |
|
| 30 | 50 | XGCValues gcv; |
|
| 31 | - | XPoint points[5]; |
|
| 32 | 51 | XRectangle r = { dc.x, dc.y, dc.w, dc.h }; |
|
| 33 | 52 | ||
| 34 | 53 | XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg); |
|
| 35 | 54 | XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); |
|
| 55 | + | drawborder(); |
|
| 56 | + | ||
| 36 | 57 | if(!text) |
|
| 37 | 58 | return; |
|
| 38 | 59 | ||
| 66 | 87 | XChangeGC(dpy, dc.gc, GCForeground | GCBackground | GCFont, &gcv); |
|
| 67 | 88 | XDrawImageString(dpy, dc.drawable, dc.gc, x, y, buf, len); |
|
| 68 | 89 | } |
|
| 69 | - | ||
| 70 | - | XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); |
|
| 71 | - | points[0].x = dc.x; |
|
| 72 | - | points[0].y = dc.y; |
|
| 73 | - | points[1].x = dc.w - 1; |
|
| 74 | - | points[1].y = 0; |
|
| 75 | - | points[2].x = 0; |
|
| 76 | - | points[2].y = dc.h - 1; |
|
| 77 | - | points[3].x = -(dc.w - 1); |
|
| 78 | - | points[3].y = 0; |
|
| 79 | - | points[4].x = 0; |
|
| 80 | - | points[4].y = -(dc.h - 1); |
|
| 81 | - | XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious); |
|
| 82 | 90 | } |
|
| 83 | 91 | ||
| 84 | 92 | /* extern */ |
|
| 43 | 43 | int x, y, w, h; |
|
| 44 | 44 | unsigned long bg; |
|
| 45 | 45 | unsigned long fg; |
|
| 46 | + | unsigned long border; |
|
| 46 | 47 | Drawable drawable; |
|
| 47 | 48 | Fnt font; |
|
| 48 | 49 | GC gc; |
| 217 | 217 | /* style */ |
|
| 218 | 218 | dc.bg = getcolor(BGCOLOR); |
|
| 219 | 219 | dc.fg = getcolor(FGCOLOR); |
|
| 220 | + | dc.border = getcolor(BORDERCOLOR); |
|
| 220 | 221 | setfont(FONT); |
|
| 221 | 222 | ||
| 222 | 223 | sx = sy = 0; |