/* -*- mode: C; tab-width: 4 -*-
- * xscreensaver, Copyright (c) 1992-2006 Jamie Zawinski <jwz@jwz.org>
+ * xscreensaver, Copyright (c) 1992-2013 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
struct coo xy_coo[10];
int delay, radius, speed, number, blackhole, vortex, magnify, reflect, slow;
+ int duration;
+ time_t start_time;
+
XWindowAttributes xgwa;
GC gc;
unsigned long black_pixel;
st->window = window;
st->delay = get_integer_resource(st->dpy, "delay", "Integer");
+ st->duration = get_integer_resource (st->dpy, "duration", "Seconds");
st->radius = get_integer_resource(st->dpy, "radius", "Integer");
st->speed = get_integer_resource(st->dpy, "speed", "Integer");
st->number = get_integer_resource(st->dpy, "number", "Integer");
+ if (st->delay < 0) st->delay = 0;
+ if (st->duration < 1) st->duration = 1;
+
#ifdef HAVE_XSHM_EXTENSION
st->use_shm = get_boolean_resource(st->dpy, "useSHM", "Boolean");
#endif /* HAVE_XSHM_EXTENSION */
st->img_loader = load_image_async_simple (0, st->xgwa.screen, st->window,
st->window, 0, 0);
+ st->start_time = time ((time_t) 0);
return st;
}
{
int i;
+ st->start_time = time ((time_t) 0);
+
st->buffer_map = 0;
st->orig_map = XGetImage(st->dpy, st->window, 0, 0, st->xgwa.width, st->xgwa.height,
~0L, ZPixmap);
if (st->img_loader) /* still loading */
{
st->img_loader = load_image_async_simple (st->img_loader, 0, 0, 0, 0, 0);
- if (! st->img_loader) /* just finished */
+ if (! st->img_loader) { /* just finished */
distort_finish_loading (st);
+ }
return st->delay;
}
+ if (!st->img_loader &&
+ st->start_time + st->duration < time ((time_t) 0)) {
+ st->img_loader = load_image_async_simple (0, st->xgwa.screen, st->window,
+ st->window, 0, 0);
+ return st->delay;
+ }
+
for (k = 0; k < st->number; k++) {
st->effect(st,k);
st->draw(st,k);
distort_reshape (Display *dpy, Window window, void *closure,
unsigned int w, unsigned int h)
{
+ struct state *st = (struct state *) closure;
+ XGetWindowAttributes (st->dpy, st->window, &st->xgwa);
+ /* XClearWindow (dpy, window); */
+ /* Why doesn't this work? */
+ if (st->orig_map) /* created in distort_finish_loading, might be early */
+ XPutImage (st->dpy, st->window, st->gc, st->orig_map,
+ 0, 0, st->orig_map->width, st->orig_map->height, 0, 0);
}
static Bool
static const char *distort_defaults [] = {
"*dontClearRoot: True",
"*background: Black",
+ "*fpsSolid: true",
#ifdef __sgi /* really, HAVE_READ_DISPLAY_EXTENSION */
"*visualID: Best",
#endif
"*delay: 20000",
+ "*duration: 120",
"*radius: 0",
"*speed: 0",
"*number: 0",
#ifdef HAVE_XSHM_EXTENSION
"*useSHM: False", /* xshm turns out not to help. */
#endif /* HAVE_XSHM_EXTENSION */
+#ifdef USE_IPHONE
+ "*ignoreRotation: True",
+#endif
0
};
static XrmOptionDescRec distort_options [] = {
{ "-delay", ".delay", XrmoptionSepArg, 0 },
+ { "-duration", ".duration", XrmoptionSepArg, 0 },
{ "-radius", ".radius", XrmoptionSepArg, 0 },
{ "-speed", ".speed", XrmoptionSepArg, 0 },
{ "-number", ".number", XrmoptionSepArg, 0 },