projects
/
xscreensaver
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
From http://www.jwz.org/xscreensaver/xscreensaver-5.31.tar.gz
[xscreensaver]
/
hacks
/
wander.c
diff --git
a/hacks/wander.c
b/hacks/wander.c
index 6b8819a9ae0fb47d2654951694c70549e3994069..efe9b94bbb9216ef6bb6b9cf9b40a1edae0025a8 100644
(file)
--- a/
hacks/wander.c
+++ b/
hacks/wander.c
@@
-33,6
+33,7
@@
struct state {
int height;
unsigned int length;
unsigned int reset;
int height;
unsigned int length;
unsigned int reset;
+ Bool reset_p;
unsigned int size;
int width;
int delay;
unsigned int size;
int width;
int delay;
@@
-64,12
+65,13
@@
wander_init (Display *dpy, Window window)
st->color_map = attributes.colormap;
if (st->color_count)
{
st->color_map = attributes.colormap;
if (st->color_count)
{
- free_colors (st->dpy, st->color_map, st->colors, st->color_count);
+ free_colors (attributes.screen, st->color_map,
+ st->colors, st->color_count);
st->color_count = 0;
}
st->context = XCreateGC (st->dpy, st->window, 0, &values);
st->color_count = MAXIMUM_COLOR_COUNT;
st->color_count = 0;
}
st->context = XCreateGC (st->dpy, st->window, 0, &values);
st->color_count = MAXIMUM_COLOR_COUNT;
- make_color_loop (
st->dpy
, st->color_map,
+ make_color_loop (
attributes.screen, attributes.visual
, st->color_map,
0, 1, 1,
120, 1, 1,
240, 1, 1,
0, 1, 1,
120, 1, 1,
240, 1, 1,
@@
-168,8
+170,9
@@
wander_draw (Display *dpy, Window window, void *closure)
}
}
}
}
- if ((random () % st->reset_limit) == 0)
+ if (
st->reset_p ||
(random () % st->reset_limit) == 0)
{
{
+ st->reset_p = 0;
st->eraser = erase_window (st->dpy, st->window, st->eraser);
st->color = st->colors [random () % st->color_count].pixel;
st->x = random () % st->width;
st->eraser = erase_window (st->dpy, st->window, st->eraser);
st->color = st->colors [random () % st->color_count].pixel;
st->x = random () % st->width;
@@
-210,11
+213,22
@@
static void
wander_reshape (Display *dpy, Window window, void *closure,
unsigned int w, unsigned int h)
{
wander_reshape (Display *dpy, Window window, void *closure,
unsigned int w, unsigned int h)
{
+ struct state *st = (struct state *) closure;
+ st->width = w / st->size;
+ st->height = h / st->size;
+ st->width_1 = st->width - 1;
+ st->height_1 = st->height - 1;
}
static Bool
wander_event (Display *dpy, Window window, void *closure, XEvent *event)
{
}
static Bool
wander_event (Display *dpy, Window window, void *closure, XEvent *event)
{
+ struct state *st = (struct state *) closure;
+ if (screenhack_event_helper (dpy, window, event))
+ {
+ st->reset_p = 1;
+ return True;
+ }
return False;
}
return False;
}
@@
-235,6
+249,9
@@
static const char *wander_defaults [] =
".reset: 2500000",
".circles: False",
".size: 1",
".reset: 2500000",
".circles: False",
".size: 1",
+#ifdef USE_IPHONE
+ "*ignoreRotation: True",
+#endif
0
};
0
};