48279640b7d074448807cf9a9ea61a782272d94f
[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 /* I'm told that the Sun version of OpenGL needs to have the constant
21    SUN_OGL_NO_VERTEX_MACROS defined in order for morph3d to compile
22    (the number of arguments to the glNormal3f macro changes...)
23    Verified with gcc 2.7.2.2 and Sun cc 4.2 with OpenGL 1.1.1 dev 4
24    on Solaris 2.5.1.
25  */
26 #ifndef HAVE_MESA_GL
27 # if defined(__sun) && defined(__SVR4)  /* Solaris */
28 #  define SUN_OGL_NO_VERTEX_MACROS 1
29 # endif /* Solaris */
30 #endif /* !HAVE_MESA_GL */
31
32
33 /* Compatibility with the xlockmore RNG API
34    (note that the xlockmore hacks never expect negative numbers.)
35  */
36 #define LRAND()                 ((long) (random() & 0x7fffffff))
37 #define NRAND(n)                ((int) (LRAND() % (n)))
38 #define MAXRAND                 (2147483648.0) /* unsigned 1<<31 as a float */
39 #define SRAND(n)                /* already seeded by screenhack.c */
40
41
42 typedef struct ModeInfo {
43   Display *dpy;
44   Window window;
45   Bool root_p;
46   int npixels;
47   unsigned long *pixels;
48   XColor *colors;
49   Bool writable_p;
50   unsigned long white;
51   unsigned long black;
52   XWindowAttributes xgwa;
53   GC gc;
54   long pause;
55   Bool fullrandom;
56   long cycles;
57   long batchcount;
58   long size;
59   Bool threed;
60   long threed_left_color;
61   long threed_right_color;
62   long threed_both_color;
63   long threed_none_color;
64   long threed_delta;
65   Bool wireframe_p;
66 } ModeInfo;
67
68 typedef enum {  t_String, t_Float, t_Int, t_Bool } xlockmore_type;
69
70 typedef struct {
71   void *var;
72   char *name;
73   char *classname;
74   char *def;
75   xlockmore_type type;
76 } argtype;
77
78 typedef struct {
79   char *opt;
80   char *desc;
81 } OptionStruct;
82
83 typedef struct {
84   int numopts;
85   XrmOptionDescRec *opts;
86   int numvarsdesc;
87   argtype *vars;
88   OptionStruct *desc;
89 } ModeSpecOpt;
90
91 extern void xlockmore_screenhack (Display *dpy, Window window,
92                                   Bool want_writable_colors,
93                                   Bool want_uniform_colors,
94                                   Bool want_smooth_colors,
95                                   Bool want_bright_colors,
96                                   void (*hack_init) (ModeInfo *),
97                                   void (*hack_draw) (ModeInfo *),
98                                   void (*hack_free) (ModeInfo *));
99
100 #ifdef USE_GL
101 extern Visual *get_gl_visual (Screen *screen, char *name, char *class);
102 #endif
103
104 #endif /* __XLOCKMORE_INTERNAL_H__ */