- if (mono_p || p->primary)
- XSetForeground (dpy, draw_gc, default_fg_pixel);
- else
- XSetForeground (dpy, draw_gc, p->color.pixel);
-
- if /*(p->primary)*/ (size > 2)
- XFillArc (dpy, window, draw_gc, x, y, size, size, 0, 360*64);
- else
- XFillRectangle (dpy, window, draw_gc, x, y, size, size);
- }
+ if (size > 0)
+ {
+ static unsigned long last_pixel = ~0;
+ unsigned long pixel;
+
+ if (mono_p || p->primary)
+ pixel = default_fg_pixel;
+ else
+ pixel = p->color.pixel;
+
+ if (pixel != last_pixel)
+ {
+ last_pixel = pixel;
+ XSetForeground (dpy, draw_gc, pixel);
+ }
+
+ if (size == 1)
+ XDrawPoint (dpy, window, draw_gc, x, y);
+ else if (size < 4)
+ XFillRectangle (dpy, window, draw_gc, x, y, size, size);
+ else
+ XFillArc (dpy, window, draw_gc, x, y, size, size, 0, 360*64);
+ }
+ }