From 9280700c8f31f206e9f70e4527528de5ba009040 Mon Sep 17 00:00:00 2001 From: Alexander Sedov Date: Tue, 19 Feb 2013 03:48:06 +0400 Subject: [PATCH] Ugly workaround for X shenanigans. --- st.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/st.c b/st.c index 64366af..5d1cfde 100644 --- a/st.c +++ b/st.c @@ -2289,6 +2289,7 @@ void xloadcols(void) { int i, r, g, b; XRenderColor color = { .alpha = 0 }; + char tempcname[] = "#rrrrggggbbbb"; /* load colors [0-15] colors and [256-LEN(colorname)[ (config.h) */ for(i = 0; i < LEN(colorname); i++) { @@ -2306,7 +2307,10 @@ xloadcols(void) { color.red = r == 0 ? 0 : 0x3737 + 0x2828 * r; color.green = g == 0 ? 0 : 0x3737 + 0x2828 * g; color.blue = b == 0 ? 0 : 0x3737 + 0x2828 * b; - if(!XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &color, &dc.col[i])) { + sprintf(tempcname + 1, "%04x%04x%04x", color.red, color.green, color.blue); + /* + if(!XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &color, &dc.col[i])) {*/ + if(!XftColorAllocName(xw.dpy, xw.vis, xw.cmap, tempcname, &dc.col[i])) { die("Could not allocate color %d\n", i); } i++; @@ -2316,8 +2320,11 @@ xloadcols(void) { for(r = 0; r < 24; r++, i++) { color.red = color.green = color.blue = 0x0808 + 0x0a0a * r; + sprintf(tempcname + 1, "%04x%04x%04x", color.red, color.green, color.blue); + /* if(!XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &color, - &dc.col[i])) { + &dc.col[i])) {*/ + if(!XftColorAllocName(xw.dpy, xw.vis, xw.cmap, tempcname, &dc.col[i])) { die("Could not allocate color %d\n", i); } } -- 1.7.10.4