diff options
-rw-r--r-- | dmenu.h | 3 | ||||
-rw-r--r-- | draw.c | 5 | ||||
-rw-r--r-- | main.c | 8 |
3 files changed, 9 insertions, 7 deletions
@@ -43,7 +43,8 @@ extern DC dc; /* global drawing context */ | |||
43 | /* draw.c */ | 43 | /* draw.c */ |
44 | extern void drawtext(const char *text, | 44 | extern void drawtext(const char *text, |
45 | unsigned long col[ColLast]); /* draws text with the defined color tuple */ | 45 | unsigned long col[ColLast]); /* draws text with the defined color tuple */ |
46 | extern unsigned long getcolor(const char *colstr); /* returns color of colstr */ | 46 | extern unsigned long getcolor( |
47 | const char *colstr, const char *alternate); /* returns color of colstr */ | ||
47 | extern void setfont(const char *fontstr); /* sets global font */ | 48 | extern void setfont(const char *fontstr); /* sets global font */ |
48 | extern unsigned int textw(const char *text); /* returns width of text in px */ | 49 | extern unsigned int textw(const char *text); /* returns width of text in px */ |
49 | 50 | ||
@@ -76,11 +76,12 @@ drawtext(const char *text, unsigned long col[ColLast]) { | |||
76 | } | 76 | } |
77 | 77 | ||
78 | unsigned long | 78 | unsigned long |
79 | getcolor(const char *colstr) { | 79 | getcolor(const char *colstr, const char *alternate) { |
80 | Colormap cmap = DefaultColormap(dpy, screen); | 80 | Colormap cmap = DefaultColormap(dpy, screen); |
81 | XColor color; | 81 | XColor color; |
82 | 82 | ||
83 | XAllocNamedColor(dpy, cmap, colstr, &color, &color); | 83 | if(XAllocNamedColor(dpy, cmap, colstr, &color, &color) != Success) |
84 | XAllocNamedColor(dpy, cmap, alternate, &color, &color); | ||
84 | return color.pixel; | 85 | return color.pixel; |
85 | } | 86 | } |
86 | 87 | ||
@@ -341,10 +341,10 @@ main(int argc, char *argv[]) { | |||
341 | maxname = readstdin(); | 341 | maxname = readstdin(); |
342 | 342 | ||
343 | /* style */ | 343 | /* style */ |
344 | dc.sel[ColBG] = getcolor(selbg); | 344 | dc.norm[ColBG] = getcolor(normbg, NORMBGCOLOR); |
345 | dc.sel[ColFG] = getcolor(selfg); | 345 | dc.norm[ColFG] = getcolor(normfg, NORMFGCOLOR); |
346 | dc.norm[ColBG] = getcolor(normbg); | 346 | dc.sel[ColBG] = getcolor(selbg, SELBGCOLOR); |
347 | dc.norm[ColFG] = getcolor(normfg); | 347 | dc.sel[ColFG] = getcolor(selfg, SELFGCOLOR); |
348 | setfont(font); | 348 | setfont(font); |
349 | 349 | ||
350 | wa.override_redirect = 1; | 350 | wa.override_redirect = 1; |