From http://www.jwz.org/xscreensaver/xscreensaver-5.35.tar.gz
[xscreensaver] / hacks / ifs.c
index d79f0f32c9f9b23272a50817a920e629bd69fdd0..9adbdf2f2c54b7fa74ba87b30ff7d23189fec6c3 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright © Chris Le Sueur and Robby Griffin, 2005-2006
+/* Copyright Â© Chris Le Sueur and Robby Griffin, 2005-2006
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
@@ -92,6 +92,7 @@ myrandom(float up)
 static const char *ifs_defaults [] = {
   ".background:                Black",
   "*lensnum:           3",
+  "*fpsSolid:          true",
   "*length:            9",
   "*mode:              0",
   "*colors:            200",
@@ -101,10 +102,13 @@ static const char *ifs_defaults [] = {
   "*rotate:            True",
   "*recurse:           False",
   "*multi:              True",
-# ifdef HAVE_COCOA     /* Don't second-guess Quartz's double-buffering */
+# ifdef HAVE_JWXYZ     /* Don't second-guess Quartz's double-buffering */
   "*doubleBuffer:      False",
 #else
   "*doubleBuffer:      True",
+#endif
+#ifdef HAVE_MOBILE
+  "*ignoreRotation:     True",
 #endif
   0
 };
@@ -432,9 +436,10 @@ ifs_init (Display *d_arg, Window w_arg)
   if (st->ncolours < st->lensnum)
     st->ncolours = st->lensnum;
   if (st->colours) free(st->colours);
+  if (st->ncolours < 1) st->ncolours = 1;
   st->colours = (XColor *)calloc(st->ncolours, sizeof(XColor));
   if (!st->colours) exit(1);
-  make_smooth_colormap (st->dpy, xgwa.visual, xgwa.colormap, 
+  make_smooth_colormap (xgwa.screen, xgwa.visual, xgwa.colormap, 
                         st->colours, &st->ncolours,
                         True, 0, False);
 
@@ -512,6 +517,20 @@ ifs_reshape (Display *dpy, Window window, void *closure,
 static Bool
 ifs_event (Display *dpy, Window window, void *closure, XEvent *event)
 {
+  struct state *st = (struct state *)closure;
+  if (screenhack_event_helper (dpy, window, event))
+    {
+      int i;
+      for (i = 0; i < st->lensnum; i++) {
+        CreateLens(st,
+                   myrandom(1)-0.5,
+                   myrandom(1),
+                   myrandom(4)-2,
+                   myrandom(4)+2,
+                   &st->lenses[i]);
+      }
+      return True;
+    }
   return False;
 }