1 |
< |
/* Copyright (c) 1991 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1992 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
41 |
|
#define ICONSIZ (8*10) /* maximum icon dimension (even 8) */ |
42 |
|
|
43 |
|
#define ourscreen DefaultScreen(thedisplay) |
44 |
– |
#define ourblack BlackPixel(thedisplay,ourscreen) |
45 |
– |
#define ourwhite WhitePixel(thedisplay,ourscreen) |
44 |
|
#define ourroot RootWindow(thedisplay,ourscreen) |
45 |
|
|
46 |
|
#define revline(x0,y0,x1,y1) XDrawLine(thedisplay,wind,revgc,x0,y0,x1,y1) |
55 |
|
char *dispname = NULL; /* our display name */ |
56 |
|
|
57 |
|
Window wind = 0; /* our output window */ |
58 |
+ |
unsigned long ourblack=0, ourwhite=1; /* black and white for this visual */ |
59 |
|
Font fontid; /* our font */ |
60 |
|
|
61 |
|
int maxcolors = 0; /* maximum colors */ |
240 |
|
CWBackPixel|CWBorderPixel|CWColormap, &ourwinattr); |
241 |
|
if (wind == 0) |
242 |
|
quiterr("cannot create window"); |
243 |
+ |
XFreeColormap(thedisplay, ourwinattr.colormap); |
244 |
|
width = xmax; |
245 |
|
height = ymax; |
246 |
|
ourgc = XCreateGC(thedisplay, wind, 0, 0); |
247 |
< |
XSetState(thedisplay, ourgc, BlackPixel(thedisplay,ourscreen), |
248 |
< |
WhitePixel(thedisplay,ourscreen), GXcopy, AllPlanes); |
247 |
> |
XSetState(thedisplay, ourgc, ourblack, ourwhite, GXcopy, AllPlanes); |
248 |
|
revgc = XCreateGC(thedisplay, wind, 0, 0); |
249 |
|
XSetFunction(thedisplay, revgc, GXinvert); |
250 |
|
fontid = XLoadFont(thedisplay, FONTNAME); |
415 |
|
fprintf(stderr, "Selected visual type %s, depth %d\n", |
416 |
|
vistype[ourvis.class], ourvis.depth); |
417 |
|
#endif |
418 |
+ |
/* make appropriate adjustments */ |
419 |
|
if (ourvis.class == GrayScale || ourvis.class == StaticGray) |
420 |
|
greyscale = 1; |
421 |
|
if (ourvis.depth <= 8 && ourvis.colormap_size < maxcolors) |
422 |
|
maxcolors = ourvis.colormap_size; |
423 |
|
if (maxcolors > 4) |
424 |
|
maxcolors -= 2; |
425 |
+ |
if (ourvis.class == StaticGray) { |
426 |
+ |
ourblack = 0; |
427 |
+ |
ourwhite = 255; |
428 |
+ |
} else if (ourvis.class == PseudoColor) { |
429 |
+ |
ourblack = BlackPixel(thedisplay,ourscreen); |
430 |
+ |
ourwhite = WhitePixel(thedisplay,ourscreen); |
431 |
+ |
if ((ourblack|ourwhite) & ~255L) { |
432 |
+ |
ourblack = 0; |
433 |
+ |
ourwhite = 1; |
434 |
+ |
} |
435 |
+ |
} else { |
436 |
+ |
ourblack = 0; |
437 |
+ |
ourwhite = ourvis.red_mask|ourvis.green_mask|ourvis.blue_mask; |
438 |
+ |
} |
439 |
|
XFree((char *)xvi); |
440 |
|
} |
441 |
|
|