- init_spin (discs[0]);
-
- gcv.foreground = get_pixel_resource ("arrow2Foreground", "Foreground",
- dpy, xgwa.colormap);
- gcv.line_width = MAX(4, (size / 30));
- discs[1]->draw = draw_thick_arrow;
- discs[1]->gc = XCreateGC (dpy, b, GCForeground|GCLineWidth, &gcv);
- init_spin (discs[1]);
-
- gcv.foreground = get_pixel_resource ("arrow1Foreground", "Foreground",
- dpy, xgwa.colormap);
- gcv.line_width = MAX(4, (size / 30));
- discs[2]->draw = draw_thin_arrow;
- discs[2]->gc = XCreateGC (dpy, b, GCForeground|GCLineWidth, &gcv);
- init_spin (discs[2]);
-
- gcv.foreground = get_pixel_resource ("pointerForeground", "Foreground",
- dpy, xgwa.colormap);
- ptr_gc = XCreateGC (dpy, b, GCForeground|GCLineWidth, &gcv);
-
- gcv.foreground = get_pixel_resource ("background", "Background",
- dpy, xgwa.colormap);
- erase_gc = XCreateGC (dpy, b, GCForeground, &gcv);
-
- if (ba) XFillRectangle (dpy, ba, erase_gc, 0, 0, size2, size2);
- if (bb) XFillRectangle (dpy, bb, erase_gc, 0, 0, size2, size2);
-
- while (1)
- {
- XFillRectangle (dpy, b, erase_gc, 0, 0, xgwa.width, xgwa.height);
+ init_spin (st->discs[0]);
+
+ gcv.foreground = get_pixel_resource (st->dpy, st->xgwa.colormap,
+ "arrow2Foreground", "Foreground");
+ gcv.line_width = MAX(4, (st->size / 30));
+ st->discs[1]->draw = draw_thick_arrow;
+ st->discs[1]->gc = XCreateGC (st->dpy, st->b, GCForeground|GCLineWidth, &gcv);
+ init_spin (st->discs[1]);
+
+ gcv.foreground = get_pixel_resource (st->dpy, st->xgwa.colormap,
+ "arrow1Foreground", "Foreground");
+ gcv.line_width = MAX(4, (st->size / 30));
+ st->discs[2]->draw = draw_thin_arrow;
+ st->discs[2]->gc = XCreateGC (st->dpy, st->b, GCForeground|GCLineWidth, &gcv);
+ init_spin (st->discs[2]);
+
+ gcv.foreground = get_pixel_resource (st->dpy, st->xgwa.colormap,
+ "pointerForeground", "Foreground");
+ st->ptr_gc = XCreateGC (st->dpy, st->b, GCForeground|GCLineWidth, &gcv);
+
+ gcv.foreground = get_pixel_resource (st->dpy, st->xgwa.colormap,
+ "background", "Background");
+ st->erase_gc = XCreateGC (st->dpy, st->b, GCForeground, &gcv);
+
+ if (st->ba) XFillRectangle (st->dpy, st->ba, st->erase_gc, 0, 0, st->size2, st->size2);
+ if (st->bb) XFillRectangle (st->dpy, st->bb, st->erase_gc, 0, 0, st->size2, st->size2);
+
+ return st;
+}
+
+static unsigned long
+compass_draw (Display *dpy, Window window, void *closure)
+{
+ struct state *st = (struct state *) closure;
+ XFillRectangle (st->dpy, st->b, st->erase_gc, 0, 0, st->xgwa.width, st->xgwa.height);