28
26
and cpp-based stringification of tokens.) */
29
#include "screenhackI.h"
33
30
#include "xlockmoreI.h"
37
extern GLXContext *init_GL (ModeInfo *);
38
extern void clear_gl_error (void);
39
extern void check_gl_error (const char *type);
41
extern void do_fps (ModeInfo *);
42
extern GLfloat fps_1 (ModeInfo *);
43
extern void fps_2 (ModeInfo *);
35
# include <OpenGL/gl.h>
36
# include <OpenGL/glu.h>
37
# else /* !HAVE_COCOA -- real Xlib */
40
# endif /* !HAVE_COCOA */
45
42
# define FreeAllGL(dpy) /* */
45
# define ENTRYPOINT static
48
47
/* Accessor macros for the ModeInfo structure
51
49
#define MI_DISPLAY(MI) ((MI)->dpy)
52
50
#define MI_WINDOW(MI) ((MI)->window)
53
#define MI_NUM_SCREENS(MI) (1) /* Only manage one screen at a time; */
54
#define MI_SCREEN(MI) (0) /* this might be fragile... */
51
#define MI_NUM_SCREENS(MI) ((MI)->num_screens)
52
#define MI_SCREEN(MI) ((MI)->screen_number)
55
53
#define MI_WIN_WHITE_PIXEL(MI) ((MI)->white)
56
54
#define MI_WIN_BLACK_PIXEL(MI) ((MI)->black)
57
55
#define MI_NPIXELS(MI) ((MI)->npixels)
59
57
#define MI_WIN_WIDTH(MI) ((MI)->xgwa.width)
60
58
#define MI_WIN_HEIGHT(MI) ((MI)->xgwa.height)
61
59
#define MI_WIN_DEPTH(MI) ((MI)->xgwa.depth)
60
#define MI_DEPTH(MI) ((MI)->xgwa.depth)
62
61
#define MI_WIN_COLORMAP(MI) ((MI)->xgwa.colormap)
63
62
#define MI_VISUAL(MI) ((MI)->xgwa.visual)
64
63
#define MI_GC(MI) ((MI)->gc)
65
64
#define MI_PAUSE(MI) ((MI)->pause)
65
#define MI_DELAY(MI) ((MI)->pause)
66
66
#define MI_WIN_IS_FULLRANDOM(MI)((MI)->fullrandom)
67
67
#define MI_WIN_IS_VERBOSE(MI) (False)
68
68
#define MI_WIN_IS_INSTALL(MI) (True)
118
118
/* Maximum possible number of colors (*not* default number of colors.) */
119
119
#define NUMCOLORS 256
121
/* The globals that screenhack.c expects (initialized by xlockmore.c).
124
XrmOptionDescRec options[100];
126
/* Prototypes for the actual drawing routines...
128
extern void HACK_INIT(ModeInfo *);
129
extern void HACK_DRAW(ModeInfo *);
132
extern void HACK_FREE(ModeInfo *);
138
extern void HACK_RESHAPE(ModeInfo *, int width, int height);
140
# define HACK_RESHAPE 0
143
#ifdef HACK_HANDLE_EVENT
144
extern Bool HACK_HANDLE_EVENT(ModeInfo *, XEvent *e);
146
# define HACK_HANDLE_EVENT 0
150
/* Emit code for the entrypoint used by screenhack.c, and pass control
151
down into xlockmore.c with the appropriate parameters.
154
char *progclass = PROGCLASS;
156
void screenhack (Display *dpy, Window window)
158
xlockmore_screenhack (dpy, window,
122
/* In an Xlib world, we define two global symbols here:
123
a struct in `MODULENAME_xscreensaver_function_table',
124
and a pointer to that in `xscreensaver_function_table'.
126
In a Cocoa world, we only define the prefixed symbol;
127
the un-prefixed symbol does not exist.
130
# define XSCREENSAVER_LINK(NAME)
132
# define XSCREENSAVER_LINK(NAME) \
133
struct xscreensaver_function_table *xscreensaver_function_table = &NAME;
137
# if !defined(USE_GL) || defined(HAVE_COCOA)
138
# define xlockmore_pick_gl_visual 0
139
# define xlockmore_validate_gl_visual 0
140
# endif /* !USE_GL || HAVE_COCOA */
160
142
#ifdef WRITABLE_COLORS
166
#ifdef UNIFORM_COLORS
198
const char *app_defaults = DEFAULTS ;
143
# undef WRITABLE_COLORS
144
# define WRITABLE_COLORS 1
146
# define WRITABLE_COLORS 0
149
#if defined(UNIFORM_COLORS)
150
# define XLOCKMORE_COLOR_SCHEME color_scheme_uniform
151
#elif defined(SMOOTH_COLORS)
152
# define XLOCKMORE_COLOR_SCHEME color_scheme_smooth
153
#elif defined(BRIGHT_COLORS)
154
# define XLOCKMORE_COLOR_SCHEME color_scheme_bright
156
# define XLOCKMORE_COLOR_SCHEME color_scheme_default
159
/* This is the macro that links this program in with the rest of
160
xscreensaver. For example:
162
XSCREENSAVER_MODULE ("Atlantis", atlantis)
163
XSCREENSAVER_MODULE_2 ("GLMatrix", glmatrix, matrix)
165
CLASS: a string, the class name for resources.
166
NAME: a token, the name of the executable. Should be the same
167
as CLASS, but downcased.
168
PREFIX: the symbol used in the function names, e.g., `draw_atlantis'.
170
NAME and PREFIX are usually the same. If they are not, use
171
XSCREENSAVER_MODULE_2() instead of XSCREENSAVER_MODULE().
173
#define XSCREENSAVER_MODULE_2(CLASS,NAME,PREFIX) \
175
static struct xlockmore_function_table \
176
NAME ## _xlockmore_function_table = { \
180
XLOCKMORE_COLOR_SCHEME, \
183
reshape_ ## PREFIX, \
184
refresh_ ## PREFIX, \
185
release_ ## PREFIX, \
186
PREFIX ## _handle_event, \
190
struct xscreensaver_function_table \
191
NAME ## _xscreensaver_function_table = { \
194
& NAME ## _xlockmore_function_table, \
196
xlockmore_pick_gl_visual, \
197
xlockmore_validate_gl_visual }; \
199
XSCREENSAVER_LINK (NAME ## _xscreensaver_function_table)
201
#define XSCREENSAVER_MODULE(CLASS,PREFIX) \
202
XSCREENSAVER_MODULE_2(CLASS,PREFIX,PREFIX)