- gcv.foreground = default_fg_pixel = get_pixel_resource("foreground", "Foreground", dpy, cmap);
- draw_gc = XCreateGC(dpy, window, GCForeground, &gcv);
- ncolors = NCOLORSMAX;
- make_uniform_colormap(dpy, xgwa.visual, cmap, colors, &ncolors, True, &writeable, False);
- colorindex = random()%ncolors;
+ gcv.foreground = st->default_fg_pixel = get_pixel_resource(st->dpy, cmap, "foreground", "Foreground");
+ st->draw_gc = XCreateGC(st->dpy, st->window, GCForeground, &gcv);
+ gcv.foreground = get_pixel_resource (st->dpy, cmap, "background", "Background");
+ st->erase_gc = XCreateGC (st->dpy, st->window, GCForeground, &gcv);
+ st->ncolors = NCOLORSMAX;
+ make_uniform_colormap(st->dpy, xgwa.visual, cmap, st->colors, &st->ncolors, True, &writeable, False);
+ if (st->ncolors <= 0) {
+ st->ncolors = 2;
+ st->colors[0].red = st->colors[0].green = st->colors[0].blue = 0;
+ st->colors[1].red = st->colors[1].green = st->colors[1].blue = 0xFFFF;
+ XAllocColor(st->dpy, cmap, &st->colors[0]);
+ XAllocColor(st->dpy, cmap, &st->colors[1]);
+ }
+ st->colorindex = random()%st->ncolors;