[hackers] [st] We need all the colors to be available, so die() on some not available. || Christoph Lohmann

From: <hg_AT_suckless.org>
Date: Sat, 29 Sep 2012 11:26:05 +0200 (CEST)

changeset: 341:3dec6776a61b
tag: tip
user: Christoph Lohmann <20h_AT_r-36.net>
date: Sat Sep 29 11:23:34 2012 +0200
files: st.c
description:
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.


diff -r 6669d53b843f -r 3dec6776a61b st.c
--- a/st.c Sat Sep 29 11:17:16 2012 +0200
+++ b/st.c Sat Sep 29 11:23:34 2012 +0200
_AT_@ -1915,17 +1915,12 @@
         int i, r, g, b;
         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) */
         for(i = 0; i < LEN(colorname); i++) {
                 if(!colorname[i])
                         continue;
                 if(!XftColorAllocName(xw.dpy, xw.vis, xw.cmap, colorname[i], &dc.xft_col[i])) {
- dc.xft_col[i] = dc.xft_col[256];
- fprintf(stderr, "Could not allocate color '%s'\n", colorname[i]);
+ die("Could not allocate color '%s'\n", colorname[i]);
                 }
         }
 
_AT_@ -1937,8 +1932,7 @@
                                 xft_color.green = g == 0 ? 0 : 0x3737 + 0x2828 * g;
                                 xft_color.blue = b == 0 ? 0 : 0x3737 + 0x2828 * b;
                                 if(!XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &xft_color, &dc.xft_col[i])) {
- dc.xft_col[i] = dc.xft_col[256];
- fprintf(stderr, "Could not allocate color %d\n", i);
+ die("Could not allocate color %d\n", i);
                                 }
                                 i++;
                         }
Received on Sat Sep 29 2012 - 11:26:05 CEST

This archive was generated by hypermail 2.3.0 : Sat Sep 29 2012 - 11:36:08 CEST