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.35.tar.gz
[xscreensaver]
/
hacks
/
twang.c
diff --git
a/hacks/twang.c
b/hacks/twang.c
index dec8fbe14b8b5ca91f0fa51fddaedeebeff97203..4c434d0dff834a0308a57c3411fbeee3b3163585 100644
(file)
--- a/
hacks/twang.c
+++ b/
hacks/twang.c
@@
-107,13
+107,24
@@
struct state {
static void
grabImage_start (struct state *st, XWindowAttributes *xwa)
{
static void
grabImage_start (struct state *st, XWindowAttributes *xwa)
{
+ Pixmap p;
+ GC gc;
+ XGCValues gcv;
XFillRectangle (st->dpy, st->window, st->backgroundGC, 0, 0,
st->windowWidth, st->windowHeight);
XFillRectangle (st->dpy, st->window, st->backgroundGC, 0, 0,
st->windowWidth, st->windowHeight);
+
+ p = XCreatePixmap (st->dpy, st->window,
+ xwa->width, xwa->height, xwa->depth);
+ gc = XCreateGC (st->dpy, st->window, 0, &gcv);
+ XCopyArea (st->dpy, st->window, p, gc, 0, 0,
+ xwa->width, xwa->height, 0, 0);
st->backgroundImage =
st->backgroundImage =
- XGetImage (st->dpy,
st->window
, 0, 0, st->windowWidth, st->windowHeight,
+ XGetImage (st->dpy,
p
, 0, 0, st->windowWidth, st->windowHeight,
~0L, ZPixmap);
~0L, ZPixmap);
+ XFreeGC (st->dpy, gc);
+ XFreePixmap (st->dpy, p);
- st->start_time = time ((time_t) 0);
+ st->start_time = time ((time_t
*
) 0);
st->img_loader = load_image_async_simple (0, xwa->screen, st->window,
st->window, 0, 0);
}
st->img_loader = load_image_async_simple (0, xwa->screen, st->window,
st->window, 0, 0);
}
@@
-124,7
+135,7
@@
grabImage_done (struct state *st)
XWindowAttributes xwa;
XGetWindowAttributes (st->dpy, st->window, &xwa);
XWindowAttributes xwa;
XGetWindowAttributes (st->dpy, st->window, &xwa);
- st->start_time = time ((time_t) 0);
+ st->start_time = time ((time_t
*
) 0);
if (st->sourceImage) XDestroyImage (st->sourceImage);
st->sourceImage = XGetImage (st->dpy, st->window, 0, 0, st->windowWidth, st->windowHeight,
~0L, ZPixmap);
if (st->sourceImage) XDestroyImage (st->sourceImage);
st->sourceImage = XGetImage (st->dpy, st->window, 0, 0, st->windowWidth, st->windowHeight,
~0L, ZPixmap);
@@
-581,6
+592,7
@@
static void setupModel (struct state *st)
leftX = (st->windowWidth - (st->columns * st->tileSize) + st->tileSize) / 2;
topY = (st->windowHeight - (st->rows * st->tileSize) + st->tileSize) / 2;
leftX = (st->windowWidth - (st->columns * st->tileSize) + st->tileSize) / 2;
topY = (st->windowHeight - (st->rows * st->tileSize) + st->tileSize) / 2;
+ if (st->tileCount < 1) st->tileCount = 1;
st->tiles = calloc (st->tileCount, sizeof (Tile));
st->sortedTiles = calloc (st->tileCount, sizeof (Tile *));
st->tiles = calloc (st->tileCount, sizeof (Tile));
st->sortedTiles = calloc (st->tileCount, sizeof (Tile *));
@@
-615,7
+627,7
@@
twang_draw (Display *dpy, Window window, void *closure)
}
if (!st->img_loader &&
}
if (!st->img_loader &&
- st->start_time + st->duration < time ((time_t) 0)) {
+ st->start_time + st->duration < time ((time_t
*
) 0)) {
XWindowAttributes xgwa;
XGetWindowAttributes (st->dpy, st->window, &xgwa);
grabImage_start (st, &xgwa);
XWindowAttributes xgwa;
XGetWindowAttributes (st->dpy, st->window, &xgwa);
grabImage_start (st, &xgwa);
@@
-638,6
+650,12
@@
twang_reshape (Display *dpy, Window window, void *closure,
static Bool
twang_event (Display *dpy, Window window, void *closure, XEvent *event)
{
static Bool
twang_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;
}
return False;
}
@@
-767,8
+785,9
@@
static const char *twang_defaults [] = {
#else
"*useSHM: False",
#endif
#else
"*useSHM: False",
#endif
-#ifdef
USE_IPHON
E
+#ifdef
HAVE_MOBIL
E
"*ignoreRotation: True",
"*ignoreRotation: True",
+ "*rotateImages: True",
#endif
0
};
#endif
0
};