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
/
xflame.c
diff --git
a/hacks/xflame.c
b/hacks/xflame.c
index 717689baef0454673ef9c290f91b9e462c4fcf5c..2c1db6ef9b0fb79ff040fae2df4be76d12cf10a2 100644
(file)
--- a/
hacks/xflame.c
+++ b/
hacks/xflame.c
@@
-125,6
+125,10
@@
MakeImage(struct state *st)
{
XGCValues gcv;
{
XGCValues gcv;
+ /* #### This probably leaks SHM every time the window is resized. */
+ if (st->xim)
+ XDestroyImage (st->xim);
+
#ifdef HAVE_XSHM_EXTENSION
st->shared = True;
st->xim = create_xshm_image (st->dpy, st->visual, st->depth, ZPixmap, NULL,
#ifdef HAVE_XSHM_EXTENSION
st->shared = True;
st->xim = create_xshm_image (st->dpy, st->visual, st->depth, ZPixmap, NULL,
@@
-147,8
+151,8
@@
MakeImage(struct state *st)
}
}
}
}
- st->gc = XCreateGC(st->dpy,st->window,0,&gcv);
-
if (!st->gc) exit (1
);
+ if (! st->gc)
+
st->gc = XCreateGC(st->dpy,st->window,0,&gcv
);
}
}
@@
-215,6
+219,8
@@
InitFlame(struct state *st)
{
st->fwidth = st->width / 2;
st->fheight = st->height / 2;
{
st->fwidth = st->width / 2;
st->fheight = st->height / 2;
+
+ if (st->flame) free (st->flame);
st->flame = (unsigned char *) malloc((st->fwidth + 2) * (st->fheight + 2)
* sizeof(unsigned char));
st->flame = (unsigned char *) malloc((st->fwidth + 2) * (st->fheight + 2)
* sizeof(unsigned char));
@@
-605,8
+611,12
@@
FlamePasteData(struct state *st,
static unsigned char *
loadBitmap(struct state *st, int *w, int *h)
{
static unsigned char *
loadBitmap(struct state *st, int *w, int *h)
{
+# ifdef HAVE_JWXYZ
+ const char *bitmap_name = "(default)"; /* #### always use builtin */
+# else
char *bitmap_name = get_string_resource (st->dpy, "bitmap", "Bitmap");
char *bitmap_name = get_string_resource (st->dpy, "bitmap", "Bitmap");
-
+# endif
+
if (!bitmap_name ||
!*bitmap_name ||
!strcmp(bitmap_name, "none"))
if (!bitmap_name ||
!*bitmap_name ||
!strcmp(bitmap_name, "none"))
@@
-615,13
+625,13
@@
loadBitmap(struct state *st, int *w, int *h)
{
XImage *ximage;
unsigned char *result, *o;
{
XImage *ximage;
unsigned char *result, *o;
-
char *bits = (
char *) malloc (sizeof(bob_bits));
+
unsigned char *bits = (unsigned
char *) malloc (sizeof(bob_bits));
int x, y;
int x, y;
- int scale = ((st->width > bob_width * 1
1
) ? 2 : 1);
+ int scale = ((st->width > bob_width * 1
0
) ? 2 : 1);
memcpy (bits, bob_bits, sizeof(bob_bits));
memcpy (bits, bob_bits, sizeof(bob_bits));
- ximage = XCreateImage (st->dpy, st->visual, 1, XYBitmap, 0,
bits,
- bob_width, bob_height, 8, 0);
+ ximage = XCreateImage (st->dpy, st->visual, 1, XYBitmap, 0,
+
(char *) bits,
bob_width, bob_height, 8, 0);
ximage->byte_order = LSBFirst;
ximage->bitmap_bit_order = LSBFirst;
*w = ximage->width * scale;
ximage->byte_order = LSBFirst;
ximage->bitmap_bit_order = LSBFirst;
*w = ximage->width * scale;
@@
-634,7
+644,7
@@
loadBitmap(struct state *st, int *w, int *h)
return result;
}
else /* load a bitmap file */
return result;
}
else /* load a bitmap file */
-#ifdef HAVE_
COCOA
+#ifdef HAVE_
JWXYZ
abort(); /* #### fix me */
#else
{
abort(); /* #### fix me */
#else
{
@@
-693,7
+703,7
@@
loadBitmap(struct state *st, int *w, int *h)
*h = st->height;
return result;
}
*h = st->height;
return result;
}
-#endif /* !HAVE_
COCOA
*/
+#endif /* !HAVE_
JWXYZ
*/
*w = 0;
*h = 0;
*w = 0;
*h = 0;
@@
-717,12
+727,6
@@
xflame_init (Display *dpy, Window win)
InitColors(st);
st->theim = loadBitmap(st, &st->theimx, &st->theimy);
InitColors(st);
st->theim = loadBitmap(st, &st->theimx, &st->theimy);
- /* utils/xshm.c doesn't provide a way to free the shared-memory image, which
- makes it hard for us to react to window resizing. So, punt for now. The
- size of the window at startup is the size it will stay.
- */
- GetXInfo(st);
-
MakeImage(st);
InitFlame(st);
FlameFill(st,0);
MakeImage(st);
InitFlame(st);
FlameFill(st,0);
@@
-751,6
+755,12
@@
static void
xflame_reshape (Display *dpy, Window window, void *closure,
unsigned int w, unsigned int h)
{
xflame_reshape (Display *dpy, Window window, void *closure,
unsigned int w, unsigned int h)
{
+ struct state *st = (struct state *) closure;
+ GetXInfo(st);
+ MakeImage(st);
+ InitFlame(st);
+ FlameFill(st,0);
+ XClearWindow (dpy, window);
}
static Bool
}
static Bool
@@
-770,6
+780,8
@@
xflame_free (Display *dpy, Window window, void *closure)
static const char *xflame_defaults [] = {
".background: black",
".foreground: #FFAF5F",
static const char *xflame_defaults [] = {
".background: black",
".foreground: #FFAF5F",
+ "*fpsTop: true",
+ "*fpsSolid: true",
"*bitmap: (default)",
"*bitmapBaseline: 20",
"*delay: 10000",
"*bitmap: (default)",
"*bitmapBaseline: 20",
"*delay: 10000",