We need all the colors to be available, so die() on some not available.
This is a new opportunity to see if X11 somewhen handled colors in a strange way.master
parent
d7b1e31eec
commit
ed5b8700a6
10
st.c
10
st.c
|
@ -1915,17 +1915,12 @@ xloadcols(void) {
|
||||||
int i, r, g, b;
|
int i, r, g, b;
|
||||||
XRenderColor xft_color = { .alpha = 0 };
|
XRenderColor xft_color = { .alpha = 0 };
|
||||||
|
|
||||||
/* load default white color */
|
|
||||||
if(!XftColorAllocName(xw.dpy, xw.vis, xw.cmap, colorname[256], &dc.xft_col[256]))
|
|
||||||
die("Could not allocate color '%s'\n", colorname[256]);
|
|
||||||
|
|
||||||
/* load colors [0-15] colors and [256-LEN(colorname)[ (config.h) */
|
/* load colors [0-15] colors and [256-LEN(colorname)[ (config.h) */
|
||||||
for(i = 0; i < LEN(colorname); i++) {
|
for(i = 0; i < LEN(colorname); i++) {
|
||||||
if(!colorname[i])
|
if(!colorname[i])
|
||||||
continue;
|
continue;
|
||||||
if(!XftColorAllocName(xw.dpy, xw.vis, xw.cmap, colorname[i], &dc.xft_col[i])) {
|
if(!XftColorAllocName(xw.dpy, xw.vis, xw.cmap, colorname[i], &dc.xft_col[i])) {
|
||||||
dc.xft_col[i] = dc.xft_col[256];
|
die("Could not allocate color '%s'\n", colorname[i]);
|
||||||
fprintf(stderr, "Could not allocate color '%s'\n", colorname[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1937,8 +1932,7 @@ xloadcols(void) {
|
||||||
xft_color.green = g == 0 ? 0 : 0x3737 + 0x2828 * g;
|
xft_color.green = g == 0 ? 0 : 0x3737 + 0x2828 * g;
|
||||||
xft_color.blue = b == 0 ? 0 : 0x3737 + 0x2828 * b;
|
xft_color.blue = b == 0 ? 0 : 0x3737 + 0x2828 * b;
|
||||||
if(!XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &xft_color, &dc.xft_col[i])) {
|
if(!XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &xft_color, &dc.xft_col[i])) {
|
||||||
dc.xft_col[i] = dc.xft_col[256];
|
die("Could not allocate color %d\n", i);
|
||||||
fprintf(stderr, "Could not allocate color %d\n", i);
|
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue