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.22.tar.gz
[xscreensaver]
/
hacks
/
swirl.c
diff --git
a/hacks/swirl.c
b/hacks/swirl.c
index 9f1801b3533ff9cb0873c3a06025256451a1e8c1..efe2f8d1d89b3b57d87c35a0373792294d515c01 100644
(file)
--- a/
hacks/swirl.c
+++ b/
hacks/swirl.c
@@
-1,7
+1,7
@@
/* -*- Mode: C; tab-width: 4 -*-
* swirl --- swirly color-cycling patterns.
*/
/* -*- Mode: C; tab-width: 4 -*-
* swirl --- swirly color-cycling patterns.
*/
-#if
!defined( lint ) && !defined( SABER )
+#if
0
static const char sccsid[] = "@(#)swirl.c 4.00 97/01/01 xlockmore";
#endif
static const char sccsid[] = "@(#)swirl.c 4.00 97/01/01 xlockmore";
#endif
@@
-30,18
+30,17
@@
static const char sccsid[] = "@(#)swirl.c 4.00 97/01/01 xlockmore";
*/
#ifdef STANDALONE
*/
#ifdef STANDALONE
-# define PROGCLASS "Swirl"
-# define HACK_INIT init_swirl
-# define HACK_DRAW draw_swirl
-# define swirl_opts xlockmore_opts
# define DEFAULTS "*count: 5 \n" \
"*delay: 10000 \n" \
"*ncolors: 200 \n" \
# define DEFAULTS "*count: 5 \n" \
"*delay: 10000 \n" \
"*ncolors: 200 \n" \
- "*useSHM: True \n"
+ "*useSHM: True \n" \
+ "*fpsSolid: true \n" \
+ "*ignoreRotation: True \n" \
+
# define SMOOTH_COLORS
# define WRITABLE_COLORS
# define SMOOTH_COLORS
# define WRITABLE_COLORS
+# define swirl_handle_event 0
# include "xlockmore.h" /* from the xscreensaver distribution */
# include "xlockmore.h" /* from the xscreensaver distribution */
-# include <X11/Xutil.h>
# ifdef HAVE_XSHM_EXTENSION
# include "xshm.h"
# endif /* HAVE_XSHM_EXTENSION */
# ifdef HAVE_XSHM_EXTENSION
# include "xshm.h"
# endif /* HAVE_XSHM_EXTENSION */
@@
-50,7
+49,7
@@
static const char sccsid[] = "@(#)swirl.c 4.00 97/01/01 xlockmore";
# undef HAVE_XSHM_EXTENSION
#endif /* !STANDALONE */
# undef HAVE_XSHM_EXTENSION
#endif /* !STANDALONE */
-ModeSpecOpt swirl_opts = {
+
ENTRYPOINT
ModeSpecOpt swirl_opts = {
0, NULL, 0, NULL, NULL };
#include <time.h>
0, NULL, 0, NULL, NULL };
#include <time.h>
@@
-1246,7
+1245,7
@@
next_point(SWIRL_P swirl)
*
* - win is the window to draw in
*/
*
* - win is the window to draw in
*/
-void
+
ENTRYPOINT
void
init_swirl(ModeInfo * mi)
{
Display *display = MI_DISPLAY(mi);
init_swirl(ModeInfo * mi)
{
Display *display = MI_DISPLAY(mi);
@@
-1255,19
+1254,14
@@
init_swirl(ModeInfo * mi)
/* does the swirls array exist? */
if (swirls == NULL) {
/* does the swirls array exist? */
if (swirls == NULL) {
- int i;
-
/* allocate an array, one entry for each screen */
/* allocate an array, one entry for each screen */
- swirls = (SWIRL_P) calloc(ScreenCount(display), sizeof (SWIRL));
-
- /* initialise them all */
- for (i = 0; i < ScreenCount(display); i++)
- initialise_swirl(mi, &swirls[i]);
+ swirls = (SWIRL_P) calloc(MI_NUM_SCREENS(mi), sizeof (SWIRL));
}
/* get a pointer to this swirl */
swirl = &(swirls[MI_SCREEN(mi)]);
}
/* get a pointer to this swirl */
swirl = &(swirls[MI_SCREEN(mi)]);
-
- /* get window parameters */
+ initialise_swirl(mi, swirl);
+
+ /* get window parameters */
swirl->win = window;
swirl->width = MI_WIN_WIDTH(mi);
swirl->height = MI_WIN_HEIGHT(mi);
swirl->win = window;
swirl->width = MI_WIN_WIDTH(mi);
swirl->height = MI_WIN_HEIGHT(mi);
@@
-1348,7
+1342,7
@@
init_swirl(ModeInfo * mi)
*
* - win is the window to draw in
*/
*
* - win is the window to draw in
*/
-void
+
ENTRYPOINT
void
draw_swirl(ModeInfo * mi)
{
SWIRL_P swirl = &(swirls[MI_SCREEN(mi)]);
draw_swirl(ModeInfo * mi)
{
SWIRL_P swirl = &(swirls[MI_SCREEN(mi)]);
@@
-1359,7
+1353,7
@@
draw_swirl(ModeInfo * mi)
if (swirl->drawing) {
#ifdef STANDALONE
if (mi->writable_p)
if (swirl->drawing) {
#ifdef STANDALONE
if (mi->writable_p)
- rotate_colors(
MI_DISPLAY(mi)
, MI_COLORMAP(mi),
+ rotate_colors(
mi->xgwa.screen
, MI_COLORMAP(mi),
swirl->rgb_values, swirl->colours, 1);
#else /* !STANDALONE */
/* rotate the colours */
swirl->rgb_values, swirl->colours, 1);
#else /* !STANDALONE */
/* rotate the colours */
@@
-1381,7
+1375,7
@@
draw_swirl(ModeInfo * mi)
} else {
#ifdef STANDALONE
if (mi->writable_p)
} else {
#ifdef STANDALONE
if (mi->writable_p)
- rotate_colors(
MI_DISPLAY(mi)
, MI_COLORMAP(mi),
+ rotate_colors(
mi->xgwa.screen
, MI_COLORMAP(mi),
swirl->rgb_values, swirl->colours, 1);
#else /* !STANDALONE */
/* rotate the colours */
swirl->rgb_values, swirl->colours, 1);
#else /* !STANDALONE */
/* rotate the colours */
@@
-1419,10
+1413,9
@@
draw_swirl(ModeInfo * mi)
#ifdef STANDALONE
/* Pick a new colormap! */
XClearWindow (MI_DISPLAY(mi), MI_WINDOW(mi));
#ifdef STANDALONE
/* Pick a new colormap! */
XClearWindow (MI_DISPLAY(mi), MI_WINDOW(mi));
- free_colors (
MI_DISPLAY(mi)
, MI_COLORMAP(mi),
+ free_colors (
mi->xgwa.screen
, MI_COLORMAP(mi),
mi->colors, mi->npixels);
mi->colors, mi->npixels);
- make_smooth_colormap (MI_DISPLAY(mi),
- MI_VISUAL(mi),
+ make_smooth_colormap (mi->xgwa.screen, MI_VISUAL(mi),
MI_COLORMAP(mi),
mi->colors, &mi->npixels, True,
&mi->writable_p, True);
MI_COLORMAP(mi),
mi->colors, &mi->npixels, True,
&mi->writable_p, True);
@@
-1439,10
+1432,17
@@
draw_swirl(ModeInfo * mi)
}
}
}
}
+ENTRYPOINT void
+reshape_swirl(ModeInfo * mi, int width, int height)
+{
+ XClearWindow (MI_DISPLAY (mi), MI_WINDOW(mi));
+ init_swirl (mi);
+}
+
/****************************************************************/
/****************************************************************/
-void
-release_swirl(ModeInfo * mi)
+
ENTRYPOINT
void
+release_swirl
(ModeInfo * mi)
{
/* does the swirls array exist? */
if (swirls != NULL) {
{
/* does the swirls array exist? */
if (swirls != NULL) {
@@
-1452,10
+1452,14
@@
release_swirl(ModeInfo * mi)
for (i = 0; i < MI_NUM_SCREENS(mi); i++) {
SWIRL_P swirl = &(swirls[i]);
for (i = 0; i < MI_NUM_SCREENS(mi); i++) {
SWIRL_P swirl = &(swirls[i]);
+#ifndef STANDALONE
if (swirl->cmap != (Colormap) NULL)
XFreeColormap(MI_DISPLAY(mi), swirl->cmap);
if (swirl->cmap != (Colormap) NULL)
XFreeColormap(MI_DISPLAY(mi), swirl->cmap);
+#endif /* STANDALONE */
+#ifndef STANDALONE
if (swirl->rgb_values != NULL)
XFree((void *) swirl->rgb_values);
if (swirl->rgb_values != NULL)
XFree((void *) swirl->rgb_values);
+#endif /* !STANDALONE */
if (swirl->ximage != NULL)
XDestroyImage(swirl->ximage);
if (swirl->knots)
if (swirl->ximage != NULL)
XDestroyImage(swirl->ximage);
if (swirl->knots)
@@
-1469,8
+1473,8
@@
release_swirl(ModeInfo * mi)
/****************************************************************/
/****************************************************************/
-void
-refresh_swirl(ModeInfo * mi)
+
ENTRYPOINT
void
+refresh_swirl
(ModeInfo * mi)
{
SWIRL_P swirl = &(swirls[MI_SCREEN(mi)]);
{
SWIRL_P swirl = &(swirls[MI_SCREEN(mi)]);
@@
-1480,3
+1484,5
@@
refresh_swirl(ModeInfo * mi)
swirl->drawing = False;
}
}
swirl->drawing = False;
}
}
+
+XSCREENSAVER_MODULE ("Swirl", swirl)