1
/* xscreensaver, Copyright (c) 1992, 1997, 1998
1
/* xscreensaver, Copyright (c) 1992, 1997, 1998, 2001, 2003
2
2
* Jamie Zawinski <jwz@jwz.org>
4
4
* Permission to use, copy, modify, distribute, and sell this software and its
92
92
if (ss[0] == '0' && (ss[1] == 'x' || ss[1] == 'X')) /* 0x: parse as hex */
94
if (1 == sscanf (ss+2, "%x %c", &val, &c))
94
if (1 == sscanf (ss+2, "%x %c", (unsigned int *) &val, &c))
148
149
if (! XParseColor (dpy, cmap, s, &color))
150
fprintf (stderr, "%s: can't parse color %s\n", progname, s);
151
fprintf (stderr, "%s: can't parse color %s", progname, s);
153
155
if (! XAllocColor (dpy, cmap, &color))
155
fprintf (stderr, "%s: couldn't allocate color %s\n", progname, s);
157
fprintf (stderr, "%s: couldn't allocate color %s", progname, s);
159
162
return color.pixel;
162
return ((strlen(res_class) >= 10 &&
163
!strcmp ("Background", res_class + strlen(res_class) - 10))
164
? BlackPixel (dpy, DefaultScreen (dpy))
165
: WhitePixel (dpy, DefaultScreen (dpy)));
167
Bool black_p = (strlen(res_class) >= 10 &&
168
!strcasecmp ("Background",
169
res_class + strlen(res_class) - 10));
171
fprintf (stderr, ": using %s.\n", (black_p ? "black" : "white"));
172
color.flags = DoRed|DoGreen|DoBlue;
173
color.red = color.green = color.blue = (black_p ? 0 : 0xFFFF);
174
if (XAllocColor (dpy, cmap, &color))
178
fprintf (stderr, "%s: couldn't allocate %s either!\n", progname,
179
(black_p ? "black" : "white"));
180
/* We can't use BlackPixel/WhitePixel here, because we don't know
181
what screen we're allocating on (only an issue when running inside
182
the xscreensaver daemon: for hacks, DefaultScreen is fine.)