From http://www.jwz.org/xscreensaver/xscreensaver-5.39.tar.gz
[xscreensaver] / hacks / penetrate.c
index 721ee01600f07eb3ef1a622c3cbfd6bb8608335f..9148827ded81a1113f72e0b59def83e629921bf5 100644 (file)
@@ -172,10 +172,11 @@ static void launch (struct state *st, int xlim, int ylim, int src)
   m->splits = 0;
   if (m->jenis < 50) {
     int j = ylim * 0.4;
-    if (j)
+    if (j) {
         m->splits = random() % j;
         if (m->splits < ylim * 0.08)
                m->splits = 0;
+    }
   }
 
   /* special if we're from another missile */
@@ -387,23 +388,11 @@ penetrate_init (Display *dpy, Window window)
   if (st->lrate < 0) st->lrate = 2;
   st->startlrate = st->lrate;
 
-  st->font = XLoadQueryFont(st->dpy, levelfont);
-  if (!st->font) {
-    fprintf (stderr, "%s: could not load font %s.\n", progname, levelfont);
-    st->font = XLoadQueryFont(st->dpy, scorefont);
-    if (! st->font)
-      st->font = XLoadQueryFont(st->dpy, "fixed");
-    if (! st->font) abort();
-  }
+  st->font = load_font_retry(st->dpy, levelfont);
+  if (!st->font) abort();
 
-  st->scoreFont = XLoadQueryFont(st->dpy, scorefont);
-  if (!st->scoreFont) {
-    fprintf (stderr, "%s: could not load font %s.\n", progname, scorefont);
-    st->scoreFont = XLoadQueryFont(st->dpy, levelfont);
-    if (! st->scoreFont)
-      st->scoreFont = XLoadQueryFont(st->dpy, "fixed");
-    if (! st->scoreFont) abort();
-  }
+  st->scoreFont = load_font_retry(st->dpy, scorefont);
+  if (!st->scoreFont) abort();
 
   for (i = 0; i < kMaxMissiles; i++)
     st->missile[i].alive = 0;
@@ -436,7 +425,7 @@ penetrate_init (Display *dpy, Window window)
   gcv.foreground = get_pixel_resource(st->dpy, st->cmap, "background", "Background");
   st->erase_gc = XCreateGC(st->dpy, st->window, GCForeground, &gcv);
 
-# ifdef HAVE_COCOA
+# ifdef HAVE_JWXYZ
   jwxyz_XSetAntiAliasing (st->dpy, st->erase_gc, False);
   jwxyz_XSetAntiAliasing (st->dpy, st->draw_gc, False);
 # endif
@@ -949,6 +938,7 @@ static void
 penetrate_reshape (Display *dpy, Window window, void *closure, 
                  unsigned int w, unsigned int h)
 {
+  XClearWindow (dpy, window);
 }
 
 static Bool
@@ -966,6 +956,7 @@ penetrate_free (Display *dpy, Window window, void *closure)
 
 
 static const char *penetrate_defaults [] = {
+  ".lowrez:     true",
   ".background:        black",
   ".foreground:        white",
   "*fpsTop:    true",
@@ -973,7 +964,6 @@ static const char *penetrate_defaults [] = {
   "*bgrowth:   5",
   "*lrate:     80",
   "*smart:     False",
-  "*geometry:  800x500",
   0
 };