ftp://ftp.uni-heidelberg.de/pub/X11/contrib/applications/xscreensaver-2.07.tar.gz
[xscreensaver] / hacks / xlockmoreI.h
1 /* xlockmore.h --- xscreensaver compatibility layer for xlockmore modules.
2  * xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@netscape.com>
3  *
4  * Permission to use, copy, modify, distribute, and sell this software and its
5  * documentation for any purpose is hereby granted without fee, provided that
6  * the above copyright notice appear in all copies and that both that
7  * copyright notice and this permission notice appear in supporting
8  * documentation.  No representations are made about the suitability of this
9  * software for any purpose.  It is provided "as is" without express or 
10  * implied warranty.
11  *
12  * See xlockmore.h and xlockmore.c.
13  */
14
15 #ifndef __XLOCKMORE_INTERNAL_H__
16 #define __XLOCKMORE_INTERNAL_H__
17
18 #include "screenhack.h"
19
20 /* Compatibility with the xlockmore RNG API
21    (note that the xlockmore hacks never expect negative numbers.)
22  */
23 #define LRAND()                 ((long) (random() & 0x7fffffff))
24 #define NRAND(n)                ((int) (LRAND() % (n)))
25 #define MAXRAND                 (2147483648.0) /* unsigned 1<<31 as a float */
26 #define SRAND(n)                /* already seeded by screenhack.c */
27
28
29 typedef struct ModeInfo {
30   Display *dpy;
31   Window window;
32   Bool root_p;
33   int npixels;
34   unsigned long *pixels;
35   XColor *colors;
36   Bool writable_p;
37   unsigned long white;
38   unsigned long black;
39   XWindowAttributes xgwa;
40   GC gc;
41   long pause;
42   Bool fullrandom;
43   long cycles;
44   long batchcount;
45   long size;
46   Bool threed;
47   long threed_left_color;
48   long threed_right_color;
49   long threed_both_color;
50   long threed_none_color;
51   long threed_delta;
52   Bool wireframe_p;
53 } ModeInfo;
54
55 typedef enum {  t_String, t_Float, t_Int, t_Bool } xlockmore_type;
56
57 typedef struct {
58   void *var;
59   char *name;
60   char *classname;
61   char *def;
62   xlockmore_type type;
63 } argtype;
64
65 typedef struct {
66   char *opt;
67   char *desc;
68 } OptionStruct;
69
70 typedef struct {
71   int numopts;
72   XrmOptionDescRec *opts;
73   int numvarsdesc;
74   argtype *vars;
75   OptionStruct *desc;
76 } ModeSpecOpt;
77
78 extern void xlockmore_screenhack (Display *dpy, Window window,
79                                   Bool want_writable_colors,
80                                   Bool want_uniform_colors,
81                                   Bool want_smooth_colors,
82                                   Bool want_bright_colors,
83                                   void (*hack_init) (ModeInfo *),
84                                   void (*hack_draw) (ModeInfo *),
85                                   void (*hack_free) (ModeInfo *));
86
87 #ifdef USE_GL
88 extern Visual *get_gl_visual (Screen *screen, char *name, char *class);
89 #endif
90
91 #endif /* __XLOCKMORE_INTERNAL_H__ */