- XClearWindow (dpy, window);
- XGetWindowAttributes (dpy, window, &xgwa);
- cmap = xgwa.colormap;
- scrwid = xgwa.width;
- scrhei = xgwa.height;
-
- starsize=scrhei/480;
- if (starsize<=0)
- starsize=1;
-
- /* Setup colours */
- hsv_to_rgb (0.0, 0.0, 0.0, &bgcolor.red, &bgcolor.green, &bgcolor.blue);
- got_color = XAllocColor (dpy, cmap, &bgcolor);
- colsavailable=0;
- for (p=0;p<ps;p++) {
- if (!mono_p)
- hsv_to_rgb (random()%360, .6+.4*myrnd(), .6+.4*myrnd(), &color[p].red, &color[p].green, &color[p].blue);
- /* hsv_to_rgb (random()%360, 1.0, 1.0, &color[p].red, &color[p].green, &color[p].blue); for stronger colours! */
- if ((!mono_p) && (got_color = XAllocColor (dpy, cmap, &color[p]))) {
- colsavailable=p;
- } else {
- if (colsavailable>0) /* assign colours from those already allocated */
- color[p]=color[ p % colsavailable ];
- else
- color[p].pixel=default_fg_pixel;
- }
- }
+ if (!st->initted) {
+ st->initted = 1;
+
+ XClearWindow (st->dpy, st->window);
+ XGetWindowAttributes (st->dpy, st->window, &st->xgwa);
+ st->scrwid = st->xgwa.width;
+ st->scrhei = st->xgwa.height;
+
+ st->starsize=st->scrhei/480;
+ if (st->starsize<=0)
+ st->starsize=1;
+
+ /* Setup colours */
+ hsv_to_rgb (0.0, 0.0, 0.0, &st->bgcolor.red, &st->bgcolor.green, &st->bgcolor.blue);
+ st->got_color = XAllocColor (st->dpy, st->xgwa.colormap, &st->bgcolor);
+ st->colsavailable=0;
+ for (st->p=0;st->p<st->ps;st->p++) {
+ if (!mono_p)
+ hsv_to_rgb (random()%360, .6+.4*myrnd(), .6+.4*myrnd(), &st->color[st->p].red, &st->color[st->p].green, &st->color[st->p].blue);
+ /* hsv_to_rgb (random()%360, 1.0, 1.0, &color[p].red, &color[p].green, &color[p].blue); for stronger colours! */
+ if ((!mono_p) && (st->got_color = XAllocColor (st->dpy, st->xgwa.colormap, &st->color[st->p]))) {
+ st->colsavailable=st->p;
+ } else {
+ if (st->colsavailable>0) /* assign colours from those already allocated */
+ st->color[st->p]=st->color[ st->p % st->colsavailable ];
+ else
+ st->color[st->p].pixel=st->default_fg_pixel;
+ }
+ }