diff options
| -rw-r--r-- | config.arg.h | 1 | ||||
| -rw-r--r-- | config.default.h | 1 | ||||
| -rw-r--r-- | draw.c | 36 | ||||
| -rw-r--r-- | dwm.h | 1 | ||||
| -rw-r--r-- | main.c | 1 |
5 files changed, 26 insertions, 14 deletions
diff --git a/config.arg.h b/config.arg.h index cc3ee20..ae27c26 100644 --- a/config.arg.h +++ b/config.arg.h | |||
| @@ -11,6 +11,7 @@ const char *tags[] = { "work", "net", "fnord", NULL }; | |||
| 11 | #define FONT "-*-terminus-medium-*-*-*-12-*-*-*-*-*-iso10646-*" | 11 | #define FONT "-*-terminus-medium-*-*-*-12-*-*-*-*-*-iso10646-*" |
| 12 | #define BGCOLOR "#eeeeee" | 12 | #define BGCOLOR "#eeeeee" |
| 13 | #define FGCOLOR "#666699" | 13 | #define FGCOLOR "#666699" |
| 14 | #define BORDERCOLOR "#9999CC" | ||
| 14 | #define MODKEY Mod1Mask | 15 | #define MODKEY Mod1Mask |
| 15 | #define NUMLOCKMASK Mod2Mask | 16 | #define NUMLOCKMASK Mod2Mask |
| 16 | #define MASTERW 60 /* percent */ | 17 | #define MASTERW 60 /* percent */ |
diff --git a/config.default.h b/config.default.h index 9ce11fd..3847ff8 100644 --- a/config.default.h +++ b/config.default.h | |||
| @@ -11,6 +11,7 @@ const char *tags[] = { "0", "1", "2", "3", "4", NULL }; | |||
| 11 | #define FONT "fixed" | 11 | #define FONT "fixed" |
| 12 | #define BGCOLOR "#666699" | 12 | #define BGCOLOR "#666699" |
| 13 | #define FGCOLOR "#eeeeee" | 13 | #define FGCOLOR "#eeeeee" |
| 14 | #define BORDERCOLOR "#9999CC" | ||
| 14 | #define MODKEY Mod1Mask | 15 | #define MODKEY Mod1Mask |
| 15 | #define NUMLOCKMASK Mod2Mask | 16 | #define NUMLOCKMASK Mod2Mask |
| 16 | #define MASTERW 60 /* percent */ | 17 | #define MASTERW 60 /* percent */ |
| @@ -9,6 +9,26 @@ | |||
| 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 | |||
| 12 | static unsigned int | 32 | static unsigned int |
| 13 | textnw(const char *text, unsigned int len) | 33 | textnw(const char *text, unsigned int len) |
| 14 | { | 34 | { |
| @@ -28,11 +48,12 @@ drawtext(const char *text, Bool invert) | |||
| 28 | static char buf[256]; | 48 | static char buf[256]; |
| 29 | unsigned int len; | 49 | unsigned int len; |
| 30 | XGCValues gcv; | 50 | XGCValues gcv; |
| 31 | XPoint points[5]; | ||
| 32 | XRectangle r = { dc.x, dc.y, dc.w, dc.h }; | 51 | XRectangle r = { dc.x, dc.y, dc.w, dc.h }; |
| 33 | 52 | ||
| 34 | XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg); | 53 | XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg); |
| 35 | XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); | 54 | XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); |
| 55 | drawborder(); | ||
| 56 | |||
| 36 | if(!text) | 57 | if(!text) |
| 37 | return; | 58 | return; |
| 38 | 59 | ||
| @@ -66,19 +87,6 @@ drawtext(const char *text, Bool invert) | |||
| 66 | XChangeGC(dpy, dc.gc, GCForeground | GCBackground | GCFont, &gcv); | 87 | XChangeGC(dpy, dc.gc, GCForeground | GCBackground | GCFont, &gcv); |
| 67 | XDrawImageString(dpy, dc.drawable, dc.gc, x, y, buf, len); | 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 | /* extern */ | 92 | /* extern */ |
| @@ -43,6 +43,7 @@ struct DC { /* draw context */ | |||
| 43 | int x, y, w, h; | 43 | int x, y, w, h; |
| 44 | unsigned long bg; | 44 | unsigned long bg; |
| 45 | unsigned long fg; | 45 | unsigned long fg; |
| 46 | unsigned long border; | ||
| 46 | Drawable drawable; | 47 | Drawable drawable; |
| 47 | Fnt font; | 48 | Fnt font; |
| 48 | GC gc; | 49 | GC gc; |
| @@ -217,6 +217,7 @@ main(int argc, char *argv[]) | |||
| 217 | /* style */ | 217 | /* style */ |
| 218 | dc.bg = getcolor(BGCOLOR); | 218 | dc.bg = getcolor(BGCOLOR); |
| 219 | dc.fg = getcolor(FGCOLOR); | 219 | dc.fg = getcolor(FGCOLOR); |
| 220 | dc.border = getcolor(BORDERCOLOR); | ||
| 220 | setfont(FONT); | 221 | setfont(FONT); |
| 221 | 222 | ||
| 222 | sx = sy = 0; | 223 | sx = sy = 0; |
