1 /* xlockmore.h --- xscreensaver compatibility layer for xlockmore modules.
2 * xscreensaver, Copyright (c) 1997-2002, 2006 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 */
44 # include <OpenGL/gl.h>
50 extern GLXContext *init_GL (ModeInfo *);
51 extern void clear_gl_error (void);
52 extern void check_gl_error (const char *type);
54 extern void do_fps (ModeInfo *);
55 extern GLfloat fps_1 (ModeInfo *);
56 extern void fps_2 (ModeInfo *);
58 extern Visual *xlockmore_pick_gl_visual (Screen *);
59 extern Bool xlockmore_validate_gl_visual (Screen *, const char *, Visual *);
63 extern void xlockmore_setup (struct xscreensaver_function_table *, void *);
66 /* Compatibility with the xlockmore RNG API
67 (note that the xlockmore hacks never expect negative numbers.)
69 #define LRAND() ((long) (random() & 0x7fffffff))
70 #define NRAND(n) ((int) (LRAND() % (n)))
71 #define MAXRAND (2147483648.0) /* unsigned 1<<31 as a float */
72 #define SRAND(n) /* already seeded by screenhack.c */
76 struct xlockmore_function_table *xlmft;
83 unsigned long *pixels;
88 XWindowAttributes xgwa;
96 long threed_left_color;
97 long threed_right_color;
98 long threed_both_color;
99 long threed_none_color;
105 struct fps_state *fps_state; /* private data for fps.c */
107 unsigned long polygon_count; /* used only by FPS display */
109 #ifdef HAVE_XSHM_EXTENSION
111 XShmSegmentInfo shm_info;
115 typedef enum { t_String, t_Float, t_Int, t_Bool } xlockmore_type;
132 XrmOptionDescRec *opts;
138 struct xlockmore_function_table {
139 const char *progclass;
140 const char *defaults;
141 Bool want_writable_colors;
142 enum { color_scheme_default, color_scheme_uniform,
143 color_scheme_smooth, color_scheme_bright }
144 desired_color_scheme;
145 void (*hack_init) (ModeInfo *);
146 void (*hack_draw) (ModeInfo *);
147 void (*hack_reshape) (ModeInfo *, int, int);
148 void (*hack_refresh) (ModeInfo *);
149 void (*hack_free) (ModeInfo *);
150 Bool (*hack_handle_events) (ModeInfo *, XEvent *);
154 #endif /* __XLOCKMORE_INTERNAL_H__ */