| 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=1, ourwhite=0; /* black and white for this visual */ |
| 59 |
|
Font fontid; /* our font */ |
| 60 |
|
|
| 61 |
|
int maxcolors = 0; /* maximum colors */ |
| 243 |
|
width = xmax; |
| 244 |
|
height = ymax; |
| 245 |
|
ourgc = XCreateGC(thedisplay, wind, 0, 0); |
| 246 |
< |
XSetState(thedisplay, ourgc, BlackPixel(thedisplay,ourscreen), |
| 248 |
< |
WhitePixel(thedisplay,ourscreen), GXcopy, AllPlanes); |
| 246 |
> |
XSetState(thedisplay, ourgc, ourblack, ourwhite, GXcopy, AllPlanes); |
| 247 |
|
revgc = XCreateGC(thedisplay, wind, 0, 0); |
| 248 |
|
XSetFunction(thedisplay, revgc, GXinvert); |
| 249 |
|
fontid = XLoadFont(thedisplay, FONTNAME); |
| 414 |
|
fprintf(stderr, "Selected visual type %s, depth %d\n", |
| 415 |
|
vistype[ourvis.class], ourvis.depth); |
| 416 |
|
#endif |
| 417 |
+ |
/* make appropriate adjustments */ |
| 418 |
|
if (ourvis.class == GrayScale || ourvis.class == StaticGray) |
| 419 |
|
greyscale = 1; |
| 420 |
|
if (ourvis.depth <= 8 && ourvis.colormap_size < maxcolors) |
| 421 |
|
maxcolors = ourvis.colormap_size; |
| 422 |
|
if (maxcolors > 4) |
| 423 |
|
maxcolors -= 2; |
| 424 |
+ |
if (ourvis.class == StaticGray) { |
| 425 |
+ |
ourblack = 0; |
| 426 |
+ |
ourwhite = 255; |
| 427 |
+ |
} else if (ourvis.class == PseudoColor) { |
| 428 |
+ |
ourblack = BlackPixel(thedisplay,ourscreen); |
| 429 |
+ |
ourwhite = WhitePixel(thedisplay,ourscreen); |
| 430 |
+ |
} else { |
| 431 |
+ |
ourblack = 0; |
| 432 |
+ |
ourwhite = ~0; |
| 433 |
+ |
} |
| 434 |
|
XFree((char *)xvi); |
| 435 |
|
} |
| 436 |
|
|