From http://www.jwz.org/xscreensaver/xscreensaver-5.35.tar.gz
[xscreensaver] / hacks / blitspin.c
index 1c18881c8fda0b8347fb31fb912dc9cdba287ad8..2be03cd1fb6076d7b4512728fdd39c08cc1e36a6 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1992-2008 Jamie Zawinski <jwz@jwz.org>
+/* xscreensaver, Copyright (c) 1992-2014 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -27,6 +27,7 @@
 #include "screenhack.h"
 #include "xpm-pixmap.h"
 #include <stdio.h>
+#include <time.h>
 
 #include "images/som.xbm"
 
@@ -40,7 +41,7 @@
    So, on OSX, we implement the blitter by hand.  It is correct, but
    orders of magnitude slower.
  */
-#ifndef HAVE_COCOA
+#ifndef HAVE_JWXYZ
 # define USE_XCOPYAREA
 #endif
 
@@ -154,7 +155,7 @@ blitspin_draw (Display *dpy, Window window, void *closure)
         st->first_time = 0;
         st->loaded_p = True;
         st->qwad = -1;
-        st->start_time = time ((time_t) 0);
+        st->start_time = time ((time_t *) 0);
         blitspin_init_2 (st);
       }
 
@@ -165,7 +166,7 @@ blitspin_draw (Display *dpy, Window window, void *closure)
 
   if (!st->img_loader &&
       st->load_ext_p &&
-      st->start_time + st->duration < time ((time_t) 0)) {
+      st->start_time + st->duration < time ((time_t *) 0)) {
     /* Start a new image loading, but keep rotating the old image 
        until the new one arrives. */
     st->img_loader = load_image_async_simple (0, st->xgwa.screen, st->window,
@@ -254,7 +255,7 @@ blitspin_init (Display *d_arg, Window w_arg)
   if (st->delay2 < 0) st->delay2 = 0;
   if (st->duration < 1) st->duration = 1;
 
-  st->start_time = time ((time_t) 0);
+  st->start_time = time ((time_t *) 0);
 
   bitmap_name = get_string_resource (st->dpy, "bitmap", "Bitmap");
   if (! bitmap_name || !*bitmap_name)
@@ -296,6 +297,7 @@ blitspin_init (Display *d_arg, Window w_arg)
       st->bitmap = xpm_file_to_pixmap (st->dpy, st->window, bitmap_name,
                                    &st->width, &st->height, 0);
       st->scale_up = True; /* probably? */
+      blitspin_init_2 (st);
     }
 
   return st;
@@ -397,6 +399,12 @@ blitspin_reshape (Display *dpy, Window window, void *closure,
 static Bool
 blitspin_event (Display *dpy, Window window, void *closure, XEvent *event)
 {
+  struct state *st = (struct state *) closure;
+  if (screenhack_event_helper (dpy, window, event))
+    {
+      st->start_time = 0;
+      return True;
+    }
   return False;
 }
 
@@ -414,7 +422,10 @@ static const char *blitspin_defaults [] = {
   "*delay2:    500000",
   "*duration:  120",
   "*bitmap:    (default)",
-  "*geometry:  512x512",
+  "*geometry:  1080x1080",
+#ifdef HAVE_MOBILE
+  "*ignoreRotation: True",
+#endif
   0
 };