-
-#if 0
- * Found in Don Hopkin`s .plan file:
+/* xscreensaver, Copyright (c) 1992-2002 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
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation. No representations are made about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ */
+
+/* Found in Don Hopkins' .plan file:
*
* The color situation is a total flying circus. The X approach to
* device independence is to treat everything like a MicroVax framebuffer
* WHAT IS YOUR COLORMAP?
* cmap = DefaultColormap(display, DefaultScreen(display));
* AND WHAT IS YOUR FAVORITE COLOR?
- * favorite_color = 0; /* Black. */
- * /* Whoops! No, I mean: */
+ * favorite_color = 0; / * Black. * /
+ * / * Whoops! No, I mean: * /
* favorite_color = BlackPixel(display, DefaultScreen(display));
- * /* AAAYYYYEEEEE!! (client dumps core & falls into the chasm) */
+ * / * AAAYYYYEEEEE!! (client dumps core & falls into the chasm) * /
*
* WHAT IS YOUR DISPLAY?
* display = XOpenDisplay("unix:0");
* 8, PseudoColor, &vinfo) != 0)
* visual = vinfo.visual;
* AND WHAT IS THE NET SPEED VELOCITY OF AN XConfigureWindow REQUEST?
- * /* Is that a SubStructureRedirectMask or a ResizeRedirectMask? */
- * WHAT??! HOW AM I SUPPOSED TO KNOW THAT?
+ * / * Is that a SubStructureRedirectMask or a ResizeRedirectMask? * /
+ * WHAT?! HOW AM I SUPPOSED TO KNOW THAT?
* AAAAUUUGGGHHH!!!! (server dumps core & falls into the chasm)
- *
-#endif /* 0 */
+ */
-#ifndef _SCREENHACK_H_
-#define _SCREENHACK_H_
+#ifndef __SCREENHACK_H__
+#define __SCREENHACK_H__
-#if __STDC__
#include <stdlib.h>
+
+#include "config.h"
+
+#ifdef __hpux
+ /* Which of the ten billion standards does values.h belong to?
+ What systems always have it? */
+# include <values.h>
#endif
+#include <stdio.h>
+
#include <X11/Xlib.h>
#include <X11/Xresource.h>
#include <X11/Xos.h>
-#include "vroot.h"
+
+/* M_PI ought to have been defined in math.h, but... */
+#ifndef M_PI
+# define M_PI 3.1415926535
+#endif
+
+#ifndef M_PI_2
+# define M_PI_2 1.5707963267
+#endif
+
+#include "yarandom.h"
+#include "usleep.h"
+#include "resources.h"
+#include "hsv.h"
+#include "colors.h"
+#include "grabscreen.h"
+#include "visual.h"
extern Bool mono_p;
extern char *progname;
extern char *progclass;
extern XrmDatabase db;
extern XrmOptionDescRec options [];
-extern int options_size;
extern char *defaults [];
-#if __STDC__
-
-# define bcopy(from,to,size) memcpy((to),(from),(size))
-# define bzero(addr,size) memset((addr),0,(size))
-
-# if defined(SVR4) || defined(SYSV)
-extern int rand (void);
-extern void srand (unsigned int);
-# define random() rand()
-# define srandom(i) srand((unsigned int)(i))
-# else /* !totally-losing-SYSV */
-extern long random (void);
-extern void srandom (int);
-# endif /* !totally-losing-SYSV */
-#endif /* __STDC__ */
-
-#if __STDC__
-# define P(x)x
-#else
-# define P(x)()
-#endif
-
-extern void screenhack P((Display*,Window));
-
-#define usleep screenhack_usleep
-
-extern void screenhack_usleep P((unsigned long));
-extern char *get_string_resource P((char*,char*));
-extern Bool get_boolean_resource P((char*,char*));
-extern int get_integer_resource P((char*,char*));
-extern double get_float_resource P((char*,char*));
-extern unsigned int get_pixel_resource P((char*,char*,Display*,Colormap));
-extern unsigned int get_minutes_resource P((char*,char*));
-extern unsigned int get_seconds_resource P((char*,char*));
-
-extern Visual *get_visual_resource P((Display *, char *, char *));
-extern int get_visual_depth P((Display *, Visual *));
-
-void hsv_to_rgb P((int,double,double,unsigned short*,
- unsigned short*,unsigned short*));
-void rgb_to_hsv P((unsigned short,unsigned short,unsigned short,
- int*,double*,double*));
-void cycle_hue P((XColor*,int));
-
-void make_color_ramp P((int h1, double s1, double v1,
- int h2, double s2, double v2,
- XColor *pixels, int npixels));
+extern void screenhack (Display*,Window);
+extern void screenhack_handle_event (Display*, XEvent*);
+extern void screenhack_handle_events (Display*);
-static double _frand_tmp_;
-#define frand(f) \
- (_frand_tmp_ = (((double) random()) / \
- (((double) ((unsigned int)~0)) / ((double) (f+f)))), \
- _frand_tmp_ < 0 ? -_frand_tmp_ : _frand_tmp_)
+/* Be Posixly correct */
+#undef bzero
+#define bzero __ERROR_use_memset_not_bzero_in_xscreensaver__
+#undef bcopy
+#define bcopy __ERROR_use_memcpy_not_bcopy_in_xscreensaver__
+#undef ftime
+#define ftime __ERROR_use_gettimeofday_not_ftime_in_xscreensaver__
-#undef P
-#endif /* _SCREENHACK_H_ */
+#endif /* __SCREENHACK_H__ */