#include #include #include #include static Display *display; static Screen *screen; static Window win; static unsigned long colors[16]; static GC gc; static unsigned int x0, y0, W0, H0, bw; static void init_colors(void) { XColor c; unsigned int n; for(n=0;n<16;n++) { c.flags = DoRed|DoGreen|DoBlue; c.red = ((n&8)?0x5500:0) + ((n&4)?0xAA00:0); c.green = ((n&8)?0x5500:0) + ((n&2)?0xAA00:0); c.blue = ((n&8)?0x5500:0) + ((n&1)?0xAA00:0); if(n==6) c.green=0x5500; if(!XAllocColor(display, DefaultColormapOfScreen(screen), &c)) { fprintf(stderr, "color[%d] alloc failed\n", n); exit(-1); } colors[n] = c.pixel; } } extern unsigned long base_color(unsigned char c) { return colors[c&15]; } static void dump_info(void) { int n, j; n = ScreenCount(display); printf("ScreenCount = %d\n", n); for(j=0; j