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