~ubuntu-branches/debian/sid/xscreensaver/sid

« back to all changes in this revision

Viewing changes to hacks/xlockmore.h

  • Committer: Bazaar Package Importer
  • Author(s): Jose Luis Rivas, Tormod Volden, Jose Luis Rivas
  • Date: 2008-07-15 14:48:48 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080715144848-c6c6mhyxij0dk2p7
Tags: 5.05-3
[ Tormod Volden ]
* debian/patches/10_jwz-xscreensaver-randr-patch-3.patch:
  from upstream, addresses issues with xrandr/xinerama
  (Closes: #482385, #428797, #471920, #453708, #473681, #479715, #480231)
* fixed typo "screen < real_nscreens" in driver/lock:1527 from above patch
* drop 61_DualHead-nVidia_bug471920.patch (obsolete)
* drop 67_XineRama-mode_bug473681.patch (obsolete)
* fix m6502.o typo in hacks/Makefile.in
* refresh 53_XScreenSaver.ad.in.patch
* refresh (disabled) 60_add-ant-hack.patch

[ Jose Luis Rivas ]
* add xscreensaver-demo desktop file, thanks to Daniel Dickinson
  (Closes: #480592)
* update package descriptions (thanks jwz)
* fix categories in xscreensaver.menu
* change build-deps from xlibmesa-gl-dev to libgl1-mesa-dev,
  xutils to xutils-dev, x-dev to x11proto-core-dev.
* bump Standards-Version to 3.8.0
* add Vcs fields and Homepage to debian/control
* Flurry is not installed until the bug get fixed (Closes: #484112)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* xlockmore.h --- xscreensaver compatibility layer for xlockmore modules.
2
 
 * xscreensaver, Copyright (c) 1997-2003 Jamie Zawinski <jwz@jwz.org>
 
2
 * xscreensaver, Copyright (c) 1997-2006 Jamie Zawinski <jwz@jwz.org>
3
3
 *
4
4
 * Permission to use, copy, modify, distribute, and sell this software and its
5
5
 * documentation for any purpose is hereby granted without fee, provided that
16
16
 * to redo it, since xlockmore has diverged so far from xlock...)
17
17
 */
18
18
 
19
 
#if !defined(PROGCLASS) || !defined(HACK_INIT) || !defined(HACK_DRAW)
20
 
ERROR!  Define PROGCLASS, HACK_INIT, and HACK_DRAW before including xlockmore.h
21
 
#endif
22
 
 
23
 
#include "config.h"
 
19
#ifdef HAVE_CONFIG_H
 
20
# include "config.h"
 
21
#endif /* HAVE_CONFIG_H */
24
22
 
25
23
#ifndef __STDC__
26
24
ERROR!  Sorry, xlockmore.h requires ANSI C (gcc, for example.)
28
26
     and cpp-based stringification of tokens.) */
29
27
#endif
30
28
 
31
 
#include <stdio.h>
32
 
#include <math.h>
 
29
#include "screenhackI.h"
33
30
#include "xlockmoreI.h"
34
31
 
35
32
#ifdef USE_GL
36
 
# include <GL/glx.h>
37
 
  extern GLXContext *init_GL (ModeInfo *);
38
 
  extern void clear_gl_error (void);
39
 
  extern void check_gl_error (const char *type);
40
33
 
41
 
  extern void do_fps (ModeInfo *);
42
 
  extern GLfloat fps_1 (ModeInfo *);
43
 
  extern void    fps_2 (ModeInfo *);
 
34
# ifdef HAVE_COCOA
 
35
#  include <OpenGL/gl.h>
 
36
#  include <OpenGL/glu.h>
 
37
# else  /* !HAVE_COCOA -- real Xlib */
 
38
#  include <GL/glx.h>
 
39
#  include <GL/glu.h>
 
40
# endif /* !HAVE_COCOA */
44
41
 
45
42
# define FreeAllGL(dpy) /* */
46
 
#endif /* !USE_GL */
 
43
#endif /* USE_GL */
 
44
 
 
45
# define ENTRYPOINT static
47
46
 
48
47
/* Accessor macros for the ModeInfo structure
49
48
 */
50
 
 
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
120
120
 
121
 
/* The globals that screenhack.c expects (initialized by xlockmore.c).
122
 
 */
123
 
char *defaults[100];
124
 
XrmOptionDescRec options[100];
125
 
 
126
 
/* Prototypes for the actual drawing routines...
127
 
 */
128
 
extern void HACK_INIT(ModeInfo *);
129
 
extern void HACK_DRAW(ModeInfo *);
130
 
 
131
 
#ifdef HACK_FREE
132
 
  extern void HACK_FREE(ModeInfo *);
133
 
#else
134
 
# define HACK_FREE 0
135
 
#endif
136
 
 
137
 
#ifdef HACK_RESHAPE
138
 
  extern void HACK_RESHAPE(ModeInfo *, int width, int height);
139
 
#else
140
 
# define HACK_RESHAPE 0
141
 
#endif
142
 
 
143
 
#ifdef HACK_HANDLE_EVENT
144
 
  extern Bool HACK_HANDLE_EVENT(ModeInfo *, XEvent *e);
145
 
#else
146
 
# define HACK_HANDLE_EVENT 0
147
 
#endif
148
 
 
149
 
 
150
 
/* Emit code for the entrypoint used by screenhack.c, and pass control
151
 
   down into xlockmore.c with the appropriate parameters.
152
 
 */
153
 
 
154
 
char *progclass = PROGCLASS;
155
 
 
156
 
void screenhack (Display *dpy, Window window)
157
 
{
158
 
  xlockmore_screenhack (dpy, window,
 
121
 
 
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'.
 
125
 
 
126
   In a Cocoa world, we only define the prefixed symbol;
 
127
   the un-prefixed symbol does not exist.
 
128
 */
 
129
#ifdef HAVE_COCOA
 
130
# define XSCREENSAVER_LINK(NAME)
 
131
#else
 
132
# define XSCREENSAVER_LINK(NAME) \
 
133
   struct xscreensaver_function_table *xscreensaver_function_table = &NAME;
 
134
#endif
 
135
 
 
136
 
 
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 */
159
141
 
160
142
#ifdef WRITABLE_COLORS
161
 
                        True,
162
 
#else
163
 
                        False,
164
 
#endif
165
 
 
166
 
#ifdef UNIFORM_COLORS
167
 
                        True,
168
 
#else
169
 
                        False,
170
 
#endif
171
 
 
172
 
#ifdef SMOOTH_COLORS
173
 
                        True,
174
 
#else
175
 
                        False,
176
 
#endif
177
 
 
178
 
#ifdef BRIGHT_COLORS
179
 
                        True,
180
 
#else
181
 
                        False,
182
 
#endif
183
 
 
184
 
#ifdef EVENT_MASK
185
 
                        EVENT_MASK,
186
 
#else
187
 
                        0,
188
 
#endif
189
 
 
190
 
                        HACK_INIT,
191
 
                        HACK_DRAW,
192
 
                        HACK_RESHAPE,
193
 
                        HACK_HANDLE_EVENT,
194
 
                        HACK_FREE);
195
 
}
196
 
 
197
 
 
198
 
const char *app_defaults = DEFAULTS ;
 
143
# undef WRITABLE_COLORS
 
144
# define WRITABLE_COLORS 1
 
145
#else
 
146
# define WRITABLE_COLORS 0
 
147
#endif
 
148
 
 
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
 
155
#else
 
156
# define XLOCKMORE_COLOR_SCHEME color_scheme_default
 
157
#endif
 
158
 
 
159
/* This is the macro that links this program in with the rest of
 
160
   xscreensaver.  For example:
 
161
 
 
162
     XSCREENSAVER_MODULE   ("Atlantis", atlantis)
 
163
     XSCREENSAVER_MODULE_2 ("GLMatrix", glmatrix, matrix)
 
164
 
 
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'.
 
169
 
 
170
   NAME and PREFIX are usually the same.  If they are not, use
 
171
   XSCREENSAVER_MODULE_2() instead of XSCREENSAVER_MODULE().
 
172
 */
 
173
#define XSCREENSAVER_MODULE_2(CLASS,NAME,PREFIX)                        \
 
174
                                                                        \
 
175
  static struct xlockmore_function_table                                \
 
176
         NAME ## _xlockmore_function_table = {                  \
 
177
           CLASS,                                                       \
 
178
           DEFAULTS,                                                    \
 
179
           WRITABLE_COLORS,                                             \
 
180
           XLOCKMORE_COLOR_SCHEME,                                      \
 
181
           init_    ## PREFIX,                                          \
 
182
           draw_    ## PREFIX,                                          \
 
183
           reshape_ ## PREFIX,                                          \
 
184
           refresh_ ## PREFIX,                                          \
 
185
           release_ ## PREFIX,                                          \
 
186
           PREFIX   ## _handle_event,                                   \
 
187
           & PREFIX ## _opts                                            \
 
188
  };                                                                    \
 
189
                                                                        \
 
190
  struct xscreensaver_function_table                                    \
 
191
         NAME ## _xscreensaver_function_table = {                       \
 
192
           0, 0, 0,                                                     \
 
193
           xlockmore_setup,                                             \
 
194
           & NAME ## _xlockmore_function_table,                         \
 
195
           0, 0, 0, 0, 0,                                               \
 
196
           xlockmore_pick_gl_visual,                                    \
 
197
           xlockmore_validate_gl_visual };                              \
 
198
                                                                        \
 
199
  XSCREENSAVER_LINK (NAME ## _xscreensaver_function_table)
 
200
 
 
201
#define XSCREENSAVER_MODULE(CLASS,PREFIX)                               \
 
202
      XSCREENSAVER_MODULE_2(CLASS,PREFIX,PREFIX)