1 /* xlockmore.h --- xscreensaver compatibility layer for xlockmore modules.
2 * xscreensaver, Copyright (c) 1997-2012 Jamie Zawinski <jwz@jwz.org>
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
12 * See xlockmore.h and xlockmore.c.
15 #ifndef __XLOCKMORE_INTERNAL_H__
16 #define __XLOCKMORE_INTERNAL_H__
20 #include "screenhackI.h"
22 #ifdef HAVE_XSHM_EXTENSION
24 #endif /* HAVE_XSHM_EXTENSION */
27 typedef struct ModeInfo ModeInfo;
31 /* I'm told that the Sun version of OpenGL needs to have the constant
32 SUN_OGL_NO_VERTEX_MACROS defined in order for morph3d to compile
33 (the number of arguments to the glNormal3f macro changes...)
34 Verified with gcc 2.7.2.2 and Sun cc 4.2 with OpenGL 1.1.1 dev 4
38 # if defined(__sun) && defined(__SVR4) /* Solaris */
39 # define SUN_OGL_NO_VERTEX_MACROS 1
41 # endif /* !HAVE_MESA_GL */
45 # include <OpenGL/gl.h>
46 # include <OpenGL/glu.h>
56 # endif /* HAVE_JWZGLES */
59 extern GLXContext *init_GL (ModeInfo *);
60 extern void xlockmore_reset_gl_state(void);
61 extern void clear_gl_error (void);
62 extern void check_gl_error (const char *type);
64 extern Visual *xlockmore_pick_gl_visual (Screen *);
65 extern Bool xlockmore_validate_gl_visual (Screen *, const char *, Visual *);
69 /* These are only used in GL mode, but I don't understand why XCode
70 isn't seeing the prototypes for them in glx/fps-gl.c... */
71 extern void do_fps (ModeInfo *);
72 extern void xlockmore_gl_compute_fps (Display *, Window, fps_state *, void *);
73 extern void xlockmore_gl_draw_fps (ModeInfo *);
74 # define do_fps xlockmore_gl_draw_fps
77 extern void xlockmore_setup (struct xscreensaver_function_table *, void *);
78 extern void xlockmore_do_fps (Display *, Window, fps_state *, void *);
81 /* Compatibility with the xlockmore RNG API
82 (note that the xlockmore hacks never expect negative numbers.)
84 #define LRAND() ((long) (random() & 0x7fffffff))
85 #define NRAND(n) ((int) (LRAND() % (n)))
86 #define MAXRAND (2147483648.0) /* unsigned 1<<31 as a float */
87 #define SRAND(n) /* already seeded by screenhack.c */
91 struct xlockmore_function_table *xlmft;
98 unsigned long *pixels;
103 XWindowAttributes xgwa;
111 long threed_left_color;
112 long threed_right_color;
113 long threed_both_color;
114 long threed_none_color;
119 /* Used only by OpenGL programs, since FPS is tricky there. */
122 unsigned long polygon_count; /* These values are for -fps display only */
123 double recursion_depth;
125 #ifdef HAVE_XSHM_EXTENSION
127 XShmSegmentInfo shm_info;
131 typedef enum { t_String, t_Float, t_Int, t_Bool } xlockmore_type;
148 XrmOptionDescRec *opts;
154 struct xlockmore_function_table {
155 const char *progclass;
156 const char *defaults;
157 Bool want_writable_colors;
158 enum { color_scheme_default, color_scheme_uniform,
159 color_scheme_smooth, color_scheme_bright }
160 desired_color_scheme;
161 void (*hack_init) (ModeInfo *);
162 void (*hack_draw) (ModeInfo *);
163 void (*hack_reshape) (ModeInfo *, int, int);
164 void (*hack_refresh) (ModeInfo *);
165 void (*hack_free) (ModeInfo *);
166 Bool (*hack_handle_events) (ModeInfo *, XEvent *);
169 unsigned screen_count; /* Only used on the OS X and iOS ports. */
172 #endif /* __XLOCKMORE_INTERNAL_H__ */