|
Lines 53-68
Link Here
|
| 53 |
|
53 |
|
| 54 |
|
54 |
|
| 55 |
unsigned long load_color(const char* s, Display *dpy) { |
55 |
unsigned long load_color(const char* s, Display *dpy) { |
| 56 |
XColor ce, cs; |
56 |
XColor ce; |
| 57 |
Colormap colormap = DefaultColormap(dpy, DefaultScreen(dpy)); |
57 |
Colormap colormap = DefaultColormap(dpy, DefaultScreen(dpy)); |
| 58 |
|
58 |
|
| 59 |
if (XLookupColor(dpy, colormap, s, &ce, &cs)) { |
59 |
if (XParseColor(dpy, colormap, s, &ce)) { |
| 60 |
if (XAllocColor(dpy, colormap, &ce)) return ce.pixel; |
60 |
if (XAllocColor(dpy, colormap, &ce)) return ce.pixel; |
| 61 |
|
61 |
|
| 62 |
fprintf(stderr, "Warning: could not allocate color\n"); |
62 |
fprintf(stderr, "Warning: could not allocate color\n"); |
| 63 |
return WhitePixel(dpy, DefaultScreen(dpy)); |
63 |
return WhitePixel(dpy, DefaultScreen(dpy)); |
| 64 |
} |
64 |
} |
| 65 |
|
65 |
|
| 66 |
fprintf(stderr, "Warning: could not lookup color\n"); |
66 |
fprintf(stderr, "Warning: could not parse color\n"); |
| 67 |
return WhitePixel(dpy, DefaultScreen(dpy)); |
67 |
return WhitePixel(dpy, DefaultScreen(dpy)); |
| 68 |
} |
68 |
} |