xref: /haiku/src/libs/glut/glutint.h (revision add916a7658b519defff1de5fb2cd5f93da4124f)
1c3eddfc0SAlexander von Gluck IV /*
2c3eddfc0SAlexander von Gluck IV  * Copyright 1994-1997 Mark Kilgard, All rights reserved.
3c3eddfc0SAlexander von Gluck IV  * Distributed under the terms of the MIT License.
4c3eddfc0SAlexander von Gluck IV  *
5*add916a7SAugustin Cavalier  * GPL licensing not permitted.
6*add916a7SAugustin Cavalier  *
7c3eddfc0SAlexander von Gluck IV  * Authors:
8c3eddfc0SAlexander von Gluck IV  *      Mark Kilgard
9c3eddfc0SAlexander von Gluck IV  */
10da465207SAlexander von Gluck IV #ifndef __glutint_h__
11da465207SAlexander von Gluck IV #define __glutint_h__
12da465207SAlexander von Gluck IV 
13da465207SAlexander von Gluck IV 
14da465207SAlexander von Gluck IV #if defined(__CYGWIN32__)
15da465207SAlexander von Gluck IV #include <sys/time.h>
16da465207SAlexander von Gluck IV #endif
17da465207SAlexander von Gluck IV 
18da465207SAlexander von Gluck IV #if defined(_WIN32)
19da465207SAlexander von Gluck IV #include "glutwin32.h"
20da465207SAlexander von Gluck IV #elif !(defined(__BEOS__) || defined(__HAIKU__))
21da465207SAlexander von Gluck IV #ifdef __sgi
22da465207SAlexander von Gluck IV #define SUPPORT_FORTRAN
23da465207SAlexander von Gluck IV #endif
24da465207SAlexander von Gluck IV #include <X11/Xlib.h>
25da465207SAlexander von Gluck IV #include <X11/Xutil.h>
26da465207SAlexander von Gluck IV #include <GL/glx.h>
27da465207SAlexander von Gluck IV #endif
28da465207SAlexander von Gluck IV 
29da465207SAlexander von Gluck IV #include <GL/glut.h>
30da465207SAlexander von Gluck IV 
31da465207SAlexander von Gluck IV /* Non-Win32 platforms need APIENTRY defined to nothing
32da465207SAlexander von Gluck IV    because all the GLUT routines have the APIENTRY prefix
33da465207SAlexander von Gluck IV    to make Win32 happy. */
34da465207SAlexander von Gluck IV #ifndef APIENTRY
35da465207SAlexander von Gluck IV #define APIENTRY
36da465207SAlexander von Gluck IV #endif
37da465207SAlexander von Gluck IV 
38da465207SAlexander von Gluck IV #ifdef __vms
39da465207SAlexander von Gluck IV #if ( __VMS_VER < 70000000 )
40da465207SAlexander von Gluck IV struct timeval {
41da465207SAlexander von Gluck IV   __int64 val;
42da465207SAlexander von Gluck IV };
43da465207SAlexander von Gluck IV extern int sys$gettim(struct timeval *);
44da465207SAlexander von Gluck IV #else
45da465207SAlexander von Gluck IV #include <time.h>
46da465207SAlexander von Gluck IV #endif
47da465207SAlexander von Gluck IV #else
48da465207SAlexander von Gluck IV #include <sys/types.h>
49da465207SAlexander von Gluck IV #if !defined(_WIN32)
50da465207SAlexander von Gluck IV #include <sys/time.h>
51da465207SAlexander von Gluck IV #else
52da465207SAlexander von Gluck IV #include <winsock.h>
53da465207SAlexander von Gluck IV #endif
54da465207SAlexander von Gluck IV #endif
55da465207SAlexander von Gluck IV #if defined(__vms) && ( __VMS_VER < 70000000 )
56da465207SAlexander von Gluck IV 
57da465207SAlexander von Gluck IV /* For VMS6.2 or lower :
58da465207SAlexander von Gluck IV    One TICK on VMS is 100 nanoseconds; 0.1 microseconds or
59da465207SAlexander von Gluck IV    0.0001 milliseconds. This means that there are 0.01
60da465207SAlexander von Gluck IV    ticks/ns, 10 ticks/us, 10,000 ticks/ms and 10,000,000
61da465207SAlexander von Gluck IV    ticks/second. */
62da465207SAlexander von Gluck IV 
63da465207SAlexander von Gluck IV #define TICKS_PER_MILLISECOND 10000
64da465207SAlexander von Gluck IV #define TICKS_PER_SECOND      10000000
65da465207SAlexander von Gluck IV 
66da465207SAlexander von Gluck IV #define GETTIMEOFDAY(_x) (void) sys$gettim (_x);
67da465207SAlexander von Gluck IV 
68da465207SAlexander von Gluck IV #define ADD_TIME(dest, src1, src2) { \
69da465207SAlexander von Gluck IV   (dest).val = (src1).val + (src2).val; \
70da465207SAlexander von Gluck IV }
71da465207SAlexander von Gluck IV 
72da465207SAlexander von Gluck IV #define TIMEDELTA(dest, src1, src2) { \
73da465207SAlexander von Gluck IV   (dest).val = (src1).val - (src2).val; \
74da465207SAlexander von Gluck IV }
75da465207SAlexander von Gluck IV 
76da465207SAlexander von Gluck IV #define IS_AFTER(t1, t2) ((t2).val > (t1).val)
77da465207SAlexander von Gluck IV 
78da465207SAlexander von Gluck IV #define IS_AT_OR_AFTER(t1, t2) ((t2).val >= (t1).val)
79da465207SAlexander von Gluck IV 
80da465207SAlexander von Gluck IV #else
81da465207SAlexander von Gluck IV #if defined(SVR4) && !defined(sun)  /* Sun claims SVR4, but
82da465207SAlexander von Gluck IV                                        wants 2 args. */
83da465207SAlexander von Gluck IV #define GETTIMEOFDAY(_x) gettimeofday(_x)
84da465207SAlexander von Gluck IV #else
85da465207SAlexander von Gluck IV #define GETTIMEOFDAY(_x) gettimeofday(_x, NULL)
86da465207SAlexander von Gluck IV #endif
87da465207SAlexander von Gluck IV #define ADD_TIME(dest, src1, src2) { \
88da465207SAlexander von Gluck IV   if(((dest).tv_usec = \
89da465207SAlexander von Gluck IV     (src1).tv_usec + (src2).tv_usec) >= 1000000) { \
90da465207SAlexander von Gluck IV     (dest).tv_usec -= 1000000; \
91da465207SAlexander von Gluck IV     (dest).tv_sec = (src1).tv_sec + (src2).tv_sec + 1; \
92da465207SAlexander von Gluck IV   } else { \
93da465207SAlexander von Gluck IV     (dest).tv_sec = (src1).tv_sec + (src2).tv_sec; \
94da465207SAlexander von Gluck IV     if(((dest).tv_sec >= 1) && (((dest).tv_usec <0))) { \
95da465207SAlexander von Gluck IV       (dest).tv_sec --;(dest).tv_usec += 1000000; \
96da465207SAlexander von Gluck IV     } \
97da465207SAlexander von Gluck IV   } \
98da465207SAlexander von Gluck IV }
99da465207SAlexander von Gluck IV #define TIMEDELTA(dest, src1, src2) { \
100da465207SAlexander von Gluck IV   if(((dest).tv_usec = (src1).tv_usec - (src2).tv_usec) < 0) { \
101da465207SAlexander von Gluck IV     (dest).tv_usec += 1000000; \
102da465207SAlexander von Gluck IV     (dest).tv_sec = (src1).tv_sec - (src2).tv_sec - 1; \
103da465207SAlexander von Gluck IV   } else { \
104da465207SAlexander von Gluck IV      (dest).tv_sec = (src1).tv_sec - (src2).tv_sec; \
105da465207SAlexander von Gluck IV   } \
106da465207SAlexander von Gluck IV }
107da465207SAlexander von Gluck IV #define IS_AFTER(t1, t2) \
108da465207SAlexander von Gluck IV   (((t2).tv_sec > (t1).tv_sec) || \
109da465207SAlexander von Gluck IV   (((t2).tv_sec == (t1).tv_sec) && \
110da465207SAlexander von Gluck IV   ((t2).tv_usec > (t1).tv_usec)))
111da465207SAlexander von Gluck IV #define IS_AT_OR_AFTER(t1, t2) \
112da465207SAlexander von Gluck IV   (((t2).tv_sec > (t1).tv_sec) || \
113da465207SAlexander von Gluck IV   (((t2).tv_sec == (t1).tv_sec) && \
114da465207SAlexander von Gluck IV   ((t2).tv_usec >= (t1).tv_usec)))
115da465207SAlexander von Gluck IV #endif
116da465207SAlexander von Gluck IV 
117da465207SAlexander von Gluck IV #define IGNORE_IN_GAME_MODE() \
118da465207SAlexander von Gluck IV   { if (__glutGameModeWindow) return; }
119da465207SAlexander von Gluck IV 
120da465207SAlexander von Gluck IV /* BeOS doesn't need most of this file */
121da465207SAlexander von Gluck IV #if (!defined(__BEOS__) && !defined(__HAIKU__))
122da465207SAlexander von Gluck IV 
123da465207SAlexander von Gluck IV #define GLUT_WIND_IS_RGB(x)         (((x) & GLUT_INDEX) == 0)
124da465207SAlexander von Gluck IV #define GLUT_WIND_IS_INDEX(x)       (((x) & GLUT_INDEX) != 0)
125da465207SAlexander von Gluck IV #define GLUT_WIND_IS_SINGLE(x)      (((x) & GLUT_DOUBLE) == 0)
126da465207SAlexander von Gluck IV #define GLUT_WIND_IS_DOUBLE(x)      (((x) & GLUT_DOUBLE) != 0)
127da465207SAlexander von Gluck IV #define GLUT_WIND_HAS_ACCUM(x)      (((x) & GLUT_ACCUM) != 0)
128da465207SAlexander von Gluck IV #define GLUT_WIND_HAS_ALPHA(x)      (((x) & GLUT_ALPHA) != 0)
129da465207SAlexander von Gluck IV #define GLUT_WIND_HAS_DEPTH(x)      (((x) & GLUT_DEPTH) != 0)
130da465207SAlexander von Gluck IV #define GLUT_WIND_HAS_STENCIL(x)    (((x) & GLUT_STENCIL) != 0)
131da465207SAlexander von Gluck IV #define GLUT_WIND_IS_MULTISAMPLE(x) (((x) & GLUT_MULTISAMPLE) != 0)
132da465207SAlexander von Gluck IV #define GLUT_WIND_IS_STEREO(x)      (((x) & GLUT_STEREO) != 0)
133da465207SAlexander von Gluck IV #define GLUT_WIND_IS_LUMINANCE(x)   (((x) & GLUT_LUMINANCE) != 0)
134da465207SAlexander von Gluck IV #define GLUT_MAP_WORK               (1 << 0)
135da465207SAlexander von Gluck IV #define GLUT_EVENT_MASK_WORK        (1 << 1)
136da465207SAlexander von Gluck IV #define GLUT_REDISPLAY_WORK         (1 << 2)
137da465207SAlexander von Gluck IV #define GLUT_CONFIGURE_WORK         (1 << 3)
138da465207SAlexander von Gluck IV #define GLUT_COLORMAP_WORK          (1 << 4)
139da465207SAlexander von Gluck IV #define GLUT_DEVICE_MASK_WORK	    (1 << 5)
140da465207SAlexander von Gluck IV #define GLUT_FINISH_WORK	    (1 << 6)
141da465207SAlexander von Gluck IV #define GLUT_DEBUG_WORK		    (1 << 7)
142da465207SAlexander von Gluck IV #define GLUT_DUMMY_WORK		    (1 << 8)
143da465207SAlexander von Gluck IV #define GLUT_FULL_SCREEN_WORK       (1 << 9)
144da465207SAlexander von Gluck IV #define GLUT_OVERLAY_REDISPLAY_WORK (1 << 10)
145da465207SAlexander von Gluck IV #define GLUT_REPAIR_WORK            (1 << 11)
146da465207SAlexander von Gluck IV #define GLUT_OVERLAY_REPAIR_WORK    (1 << 12)
147da465207SAlexander von Gluck IV 
148da465207SAlexander von Gluck IV /* Frame buffer capability macros and types. */
149da465207SAlexander von Gluck IV #define RGBA                    0
150da465207SAlexander von Gluck IV #define BUFFER_SIZE             1
151da465207SAlexander von Gluck IV #define DOUBLEBUFFER            2
152da465207SAlexander von Gluck IV #define STEREO                  3
153da465207SAlexander von Gluck IV #define AUX_BUFFERS             4
154da465207SAlexander von Gluck IV #define RED_SIZE                5  /* Used as mask bit for
155da465207SAlexander von Gluck IV                                       "color selected". */
156da465207SAlexander von Gluck IV #define GREEN_SIZE              6
157da465207SAlexander von Gluck IV #define BLUE_SIZE               7
158da465207SAlexander von Gluck IV #define ALPHA_SIZE              8
159da465207SAlexander von Gluck IV #define DEPTH_SIZE              9
160da465207SAlexander von Gluck IV #define STENCIL_SIZE            10
161da465207SAlexander von Gluck IV #define ACCUM_RED_SIZE          11  /* Used as mask bit for
162da465207SAlexander von Gluck IV                                        "acc selected". */
163da465207SAlexander von Gluck IV #define ACCUM_GREEN_SIZE        12
164da465207SAlexander von Gluck IV #define ACCUM_BLUE_SIZE         13
165da465207SAlexander von Gluck IV #define ACCUM_ALPHA_SIZE        14
166da465207SAlexander von Gluck IV #define LEVEL                   15
167da465207SAlexander von Gluck IV 
168da465207SAlexander von Gluck IV #define NUM_GLXCAPS             (LEVEL + 1)
169da465207SAlexander von Gluck IV 
170da465207SAlexander von Gluck IV #define XVISUAL                 (NUM_GLXCAPS + 0)
171da465207SAlexander von Gluck IV #define TRANSPARENT             (NUM_GLXCAPS + 1)
172da465207SAlexander von Gluck IV #define SAMPLES                 (NUM_GLXCAPS + 2)
173da465207SAlexander von Gluck IV #define XSTATICGRAY             (NUM_GLXCAPS + 3)  /* Used as
174da465207SAlexander von Gluck IV                                                       mask bit
175da465207SAlexander von Gluck IV                                                       for "any
176da465207SAlexander von Gluck IV                                                       visual type
177da465207SAlexander von Gluck IV                                                       selected". */
178da465207SAlexander von Gluck IV #define XGRAYSCALE              (NUM_GLXCAPS + 4)
179da465207SAlexander von Gluck IV #define XSTATICCOLOR            (NUM_GLXCAPS + 5)
180da465207SAlexander von Gluck IV #define XPSEUDOCOLOR            (NUM_GLXCAPS + 6)
181da465207SAlexander von Gluck IV #define XTRUECOLOR              (NUM_GLXCAPS + 7)
182da465207SAlexander von Gluck IV #define XDIRECTCOLOR            (NUM_GLXCAPS + 8)
183da465207SAlexander von Gluck IV #define SLOW                    (NUM_GLXCAPS + 9)
184da465207SAlexander von Gluck IV #define CONFORMANT              (NUM_GLXCAPS + 10)
185da465207SAlexander von Gluck IV 
186da465207SAlexander von Gluck IV #define NUM_CAPS                (NUM_GLXCAPS + 11)
187da465207SAlexander von Gluck IV 
188da465207SAlexander von Gluck IV /* Frame buffer capablities that don't have a corresponding
189da465207SAlexander von Gluck IV    FrameBufferMode entry.  These get used as mask bits. */
190da465207SAlexander von Gluck IV #define NUM                     (NUM_CAPS + 0)
191da465207SAlexander von Gluck IV #define RGBA_MODE               (NUM_CAPS + 1)
192da465207SAlexander von Gluck IV #define CI_MODE                 (NUM_CAPS + 2)
193da465207SAlexander von Gluck IV #define LUMINANCE_MODE		(NUM_CAPS + 3)
194da465207SAlexander von Gluck IV 
195da465207SAlexander von Gluck IV #define NONE			0
196da465207SAlexander von Gluck IV #define EQ			1
197da465207SAlexander von Gluck IV #define NEQ			2
198da465207SAlexander von Gluck IV #define LTE			3
199da465207SAlexander von Gluck IV #define GTE			4
200da465207SAlexander von Gluck IV #define GT			5
201da465207SAlexander von Gluck IV #define LT			6
202da465207SAlexander von Gluck IV #define MIN			7
203da465207SAlexander von Gluck IV 
204da465207SAlexander von Gluck IV typedef struct _Criterion {
205da465207SAlexander von Gluck IV   int capability;
206da465207SAlexander von Gluck IV   int comparison;
207da465207SAlexander von Gluck IV   int value;
208da465207SAlexander von Gluck IV } Criterion;
209da465207SAlexander von Gluck IV 
210da465207SAlexander von Gluck IV typedef struct _FrameBufferMode {
211da465207SAlexander von Gluck IV   XVisualInfo *vi;
212da465207SAlexander von Gluck IV #if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig)
213da465207SAlexander von Gluck IV 
214da465207SAlexander von Gluck IV   /* fbc is non-NULL when the XVisualInfo* is not OpenGL-capable
215da465207SAlexander von Gluck IV      (ie, GLX_USE_GL is false), but the SGIX_fbconfig extension shows
216da465207SAlexander von Gluck IV      the visual's fbconfig is OpenGL-capable.  The reason for this is typically
217da465207SAlexander von Gluck IV      an RGBA luminance fbconfig such as 16-bit StaticGray that could
218da465207SAlexander von Gluck IV      not be advertised as a GLX visual since StaticGray visuals are
219da465207SAlexander von Gluck IV      required (by the GLX specification) to be color index.  The
220da465207SAlexander von Gluck IV      SGIX_fbconfig allows StaticGray visuals to instead advertised as
221da465207SAlexander von Gluck IV      fbconfigs that can provide RGBA luminance support. */
222da465207SAlexander von Gluck IV 
223da465207SAlexander von Gluck IV   GLXFBConfigSGIX fbc;
224da465207SAlexander von Gluck IV #endif
225da465207SAlexander von Gluck IV   int valid;
226da465207SAlexander von Gluck IV   int cap[NUM_CAPS];
227da465207SAlexander von Gluck IV } FrameBufferMode;
228da465207SAlexander von Gluck IV 
229da465207SAlexander von Gluck IV /* DisplayMode capability macros for game mode. */
230da465207SAlexander von Gluck IV #define DM_WIDTH        0  /* "width" */
231da465207SAlexander von Gluck IV #define DM_HEIGHT       1  /* "height" */
232da465207SAlexander von Gluck IV #define DM_PIXEL_DEPTH  2  /* "bpp" (bits per pixel) */
233da465207SAlexander von Gluck IV #define DM_HERTZ        3  /* "hertz" */
234da465207SAlexander von Gluck IV #define DM_NUM          4  /* "num" */
235da465207SAlexander von Gluck IV 
236da465207SAlexander von Gluck IV #define NUM_DM_CAPS     (DM_NUM+1)
237da465207SAlexander von Gluck IV 
238da465207SAlexander von Gluck IV typedef struct _DisplayMode {
239da465207SAlexander von Gluck IV #ifdef _WIN32
240da465207SAlexander von Gluck IV   DEVMODE devmode;
241da465207SAlexander von Gluck IV #else
242da465207SAlexander von Gluck IV   /* XXX The X Window System does not have a standard
243da465207SAlexander von Gluck IV      mechanism for display setting changes.  On SGI
244da465207SAlexander von Gluck IV      systems, GLUT could use the XSGIvc (SGI X video
245da465207SAlexander von Gluck IV      control extension).  Perhaps this can be done in
246da465207SAlexander von Gluck IV      a future release of GLUT. */
247da465207SAlexander von Gluck IV #endif
248da465207SAlexander von Gluck IV   int valid;
249da465207SAlexander von Gluck IV   int cap[NUM_DM_CAPS];
250da465207SAlexander von Gluck IV } DisplayMode;
251da465207SAlexander von Gluck IV 
252da465207SAlexander von Gluck IV #endif  /* BeOS */
253da465207SAlexander von Gluck IV 
254da465207SAlexander von Gluck IV /* GLUT  function types */
255da465207SAlexander von Gluck IV typedef void (*GLUTdisplayCB) (void);
256da465207SAlexander von Gluck IV typedef void (*GLUTreshapeCB) (int, int);
257da465207SAlexander von Gluck IV typedef void (*GLUTkeyboardCB) (unsigned char, int, int);
258da465207SAlexander von Gluck IV typedef void (*GLUTmouseCB) (int, int, int, int);
259da465207SAlexander von Gluck IV typedef void (*GLUTmotionCB) (int, int);
260da465207SAlexander von Gluck IV typedef void (*GLUTpassiveCB) (int, int);
261da465207SAlexander von Gluck IV typedef void (*GLUTentryCB) (int);
262da465207SAlexander von Gluck IV typedef void (*GLUTvisibilityCB) (int);
263da465207SAlexander von Gluck IV typedef void (*GLUTwindowStatusCB) (int);
264da465207SAlexander von Gluck IV typedef void (*GLUTidleCB) (void);
265da465207SAlexander von Gluck IV typedef void (*GLUTtimerCB) (int);
266da465207SAlexander von Gluck IV typedef void (*GLUTmenuStateCB) (int);  /* DEPRICATED. */
267da465207SAlexander von Gluck IV typedef void (*GLUTmenuStatusCB) (int, int, int);
268da465207SAlexander von Gluck IV typedef void (*GLUTselectCB) (int);
269da465207SAlexander von Gluck IV typedef void (*GLUTspecialCB) (int, int, int);
270da465207SAlexander von Gluck IV typedef void (*GLUTspaceMotionCB) (int, int, int);
271da465207SAlexander von Gluck IV typedef void (*GLUTspaceRotateCB) (int, int, int);
272da465207SAlexander von Gluck IV typedef void (*GLUTspaceButtonCB) (int, int);
273da465207SAlexander von Gluck IV typedef void (*GLUTdialsCB) (int, int);
274da465207SAlexander von Gluck IV typedef void (*GLUTbuttonBoxCB) (int, int);
275da465207SAlexander von Gluck IV typedef void (*GLUTtabletMotionCB) (int, int);
276da465207SAlexander von Gluck IV typedef void (*GLUTtabletButtonCB) (int, int, int, int);
277da465207SAlexander von Gluck IV typedef void (*GLUTjoystickCB) (unsigned int buttonMask, int x, int y, int z);
278da465207SAlexander von Gluck IV #ifdef SUPPORT_FORTRAN
279da465207SAlexander von Gluck IV typedef void (*GLUTdisplayFCB) (void);
280da465207SAlexander von Gluck IV typedef void (*GLUTreshapeFCB) (int *, int *);
281da465207SAlexander von Gluck IV /* NOTE the pressed key is int, not unsigned char for Fortran! */
282da465207SAlexander von Gluck IV typedef void (*GLUTkeyboardFCB) (int *, int *, int *);
283da465207SAlexander von Gluck IV typedef void (*GLUTmouseFCB) (int *, int *, int *, int *);
284da465207SAlexander von Gluck IV typedef void (*GLUTmotionFCB) (int *, int *);
285da465207SAlexander von Gluck IV typedef void (*GLUTpassiveFCB) (int *, int *);
286da465207SAlexander von Gluck IV typedef void (*GLUTentryFCB) (int *);
287da465207SAlexander von Gluck IV typedef void (*GLUTvisibilityFCB) (int *);
288da465207SAlexander von Gluck IV typedef void (*GLUTwindowStatusFCB) (int *);
289da465207SAlexander von Gluck IV typedef void (*GLUTidleFCB) (void);
290da465207SAlexander von Gluck IV typedef void (*GLUTtimerFCB) (int *);
291da465207SAlexander von Gluck IV typedef void (*GLUTmenuStateFCB) (int *);  /* DEPRICATED. */
292da465207SAlexander von Gluck IV typedef void (*GLUTmenuStatusFCB) (int *, int *, int *);
293da465207SAlexander von Gluck IV typedef void (*GLUTselectFCB) (int *);
294da465207SAlexander von Gluck IV typedef void (*GLUTspecialFCB) (int *, int *, int *);
295da465207SAlexander von Gluck IV typedef void (*GLUTspaceMotionFCB) (int *, int *, int *);
296da465207SAlexander von Gluck IV typedef void (*GLUTspaceRotateFCB) (int *, int *, int *);
297da465207SAlexander von Gluck IV typedef void (*GLUTspaceButtonFCB) (int *, int *);
298da465207SAlexander von Gluck IV typedef void (*GLUTdialsFCB) (int *, int *);
299da465207SAlexander von Gluck IV typedef void (*GLUTbuttonBoxFCB) (int *, int *);
300da465207SAlexander von Gluck IV typedef void (*GLUTtabletMotionFCB) (int *, int *);
301da465207SAlexander von Gluck IV typedef void (*GLUTtabletButtonFCB) (int *, int *, int *, int *);
302da465207SAlexander von Gluck IV typedef void (*GLUTjoystickFCB) (unsigned int *buttonMask, int *x, int *y, int *z);
303da465207SAlexander von Gluck IV #endif
304da465207SAlexander von Gluck IV 
305da465207SAlexander von Gluck IV #if (!defined(__BEOS__) && !defined(__HAIKU__))
306da465207SAlexander von Gluck IV 
307da465207SAlexander von Gluck IV typedef struct _GLUTcolorcell GLUTcolorcell;
308da465207SAlexander von Gluck IV struct _GLUTcolorcell {
309da465207SAlexander von Gluck IV   /* GLUT_RED, GLUT_GREEN, GLUT_BLUE */
310da465207SAlexander von Gluck IV   GLfloat component[3];
311da465207SAlexander von Gluck IV };
312da465207SAlexander von Gluck IV 
313da465207SAlexander von Gluck IV typedef struct _GLUTcolormap GLUTcolormap;
314da465207SAlexander von Gluck IV struct _GLUTcolormap {
315da465207SAlexander von Gluck IV   Visual *visual;       /* visual of the colormap */
316da465207SAlexander von Gluck IV   Colormap cmap;        /* X colormap ID */
317da465207SAlexander von Gluck IV   int refcnt;           /* number of windows using colormap */
318da465207SAlexander von Gluck IV   int size;             /* number of cells in colormap */
319da465207SAlexander von Gluck IV   int transparent;      /* transparent pixel, or -1 if opaque */
320da465207SAlexander von Gluck IV   GLUTcolorcell *cells; /* array of cells */
321da465207SAlexander von Gluck IV   GLUTcolormap *next;   /* next colormap in list */
322da465207SAlexander von Gluck IV };
323da465207SAlexander von Gluck IV 
324da465207SAlexander von Gluck IV typedef struct _GLUTwindow GLUTwindow;
325da465207SAlexander von Gluck IV typedef struct _GLUToverlay GLUToverlay;
326da465207SAlexander von Gluck IV struct _GLUTwindow {
327da465207SAlexander von Gluck IV   int num;              /* Small integer window id (0-based). */
328da465207SAlexander von Gluck IV 
329da465207SAlexander von Gluck IV   /* Window system related state. */
330da465207SAlexander von Gluck IV #if defined(_WIN32)
331da465207SAlexander von Gluck IV   int pf;               /* Pixel format. */
332da465207SAlexander von Gluck IV   HDC hdc;              /* Window's Win32 device context. */
333da465207SAlexander von Gluck IV #endif
334da465207SAlexander von Gluck IV   Window win;           /* X window for GLUT window */
335da465207SAlexander von Gluck IV   GLXContext ctx;       /* OpenGL context GLUT glut window */
336da465207SAlexander von Gluck IV   XVisualInfo *vis;     /* visual for window */
337da465207SAlexander von Gluck IV   Bool visAlloced;      /* if vis needs deallocate on destroy */
338da465207SAlexander von Gluck IV   Colormap cmap;        /* RGB colormap for window; None if CI */
339da465207SAlexander von Gluck IV   GLUTcolormap *colormap;  /* colormap; NULL if RGBA */
340da465207SAlexander von Gluck IV   GLUToverlay *overlay; /* overlay; NULL if no overlay */
341da465207SAlexander von Gluck IV #if defined(_WIN32)
342da465207SAlexander von Gluck IV   HDC renderDc;         /* Win32's device context for rendering. */
343da465207SAlexander von Gluck IV #endif
344da465207SAlexander von Gluck IV   Window renderWin;     /* X window for rendering (might be
345da465207SAlexander von Gluck IV                            overlay) */
346da465207SAlexander von Gluck IV   GLXContext renderCtx; /* OpenGL context for rendering (might
347da465207SAlexander von Gluck IV                            be overlay) */
348da465207SAlexander von Gluck IV   /* GLUT settable or visible window state. */
349da465207SAlexander von Gluck IV   int width;            /* window width in pixels */
350da465207SAlexander von Gluck IV   int height;           /* window height in pixels */
351da465207SAlexander von Gluck IV   int cursor;           /* cursor name */
352da465207SAlexander von Gluck IV   int visState;         /* visibility state (-1 is unknown) */
353da465207SAlexander von Gluck IV   int shownState;       /* if window mapped */
354da465207SAlexander von Gluck IV   int entryState;       /* entry state (-1 is unknown) */
355da465207SAlexander von Gluck IV #define GLUT_MAX_MENUS              3
356da465207SAlexander von Gluck IV 
357da465207SAlexander von Gluck IV   int menu[GLUT_MAX_MENUS];  /* attatched menu nums */
358da465207SAlexander von Gluck IV   /* Window relationship state. */
359da465207SAlexander von Gluck IV   GLUTwindow *parent;   /* parent window */
360da465207SAlexander von Gluck IV   GLUTwindow *children; /* list of children */
361da465207SAlexander von Gluck IV   GLUTwindow *siblings; /* list of siblings */
362da465207SAlexander von Gluck IV   /* Misc. non-API visible (hidden) state. */
363da465207SAlexander von Gluck IV   Bool treatAsSingle;   /* treat this window as single-buffered
364da465207SAlexander von Gluck IV                            (it might be "fake" though) */
365da465207SAlexander von Gluck IV   Bool forceReshape;    /* force reshape before display */
366da465207SAlexander von Gluck IV #if !defined(_WIN32)
367da465207SAlexander von Gluck IV   Bool isDirect;        /* if direct context (X11 only) */
368da465207SAlexander von Gluck IV #endif
369da465207SAlexander von Gluck IV   Bool usedSwapBuffers; /* if swap buffers used last display */
370da465207SAlexander von Gluck IV   long eventMask;       /* mask of X events selected for */
371da465207SAlexander von Gluck IV   int buttonUses;       /* number of button uses, ref cnt */
372da465207SAlexander von Gluck IV   int tabletPos[2];     /* tablet position (-1 is invalid) */
373da465207SAlexander von Gluck IV   /* Work list related state. */
374da465207SAlexander von Gluck IV   unsigned int workMask;  /* mask of window work to be done */
375da465207SAlexander von Gluck IV   GLUTwindow *prevWorkWin;  /* link list of windows to work on */
376da465207SAlexander von Gluck IV   Bool desiredMapState; /* how to mapped window if on map work
377da465207SAlexander von Gluck IV                            list */
378da465207SAlexander von Gluck IV   Bool ignoreKeyRepeat;  /* if window ignores autorepeat */
379da465207SAlexander von Gluck IV   int desiredConfMask;  /* mask of desired window configuration
380da465207SAlexander von Gluck IV                          */
381da465207SAlexander von Gluck IV   int desiredX;         /* desired X location */
382da465207SAlexander von Gluck IV   int desiredY;         /* desired Y location */
383da465207SAlexander von Gluck IV   int desiredWidth;     /* desired window width */
384da465207SAlexander von Gluck IV   int desiredHeight;    /* desired window height */
385da465207SAlexander von Gluck IV   int desiredStack;     /* desired window stack */
386da465207SAlexander von Gluck IV   /* Per-window callbacks. */
387da465207SAlexander von Gluck IV   GLUTdisplayCB display;  /* redraw */
388da465207SAlexander von Gluck IV   GLUTreshapeCB reshape;  /* resize (width,height) */
389da465207SAlexander von Gluck IV   GLUTmouseCB mouse;    /* mouse (button,state,x,y) */
390da465207SAlexander von Gluck IV   GLUTmotionCB motion;  /* motion (x,y) */
391da465207SAlexander von Gluck IV   GLUTpassiveCB passive;  /* passive motion (x,y) */
392da465207SAlexander von Gluck IV   GLUTentryCB entry;    /* window entry/exit (state) */
393da465207SAlexander von Gluck IV   GLUTkeyboardCB keyboard;  /* keyboard (ASCII,x,y) */
394da465207SAlexander von Gluck IV   GLUTkeyboardCB keyboardUp;  /* keyboard up (ASCII,x,y) */
395da465207SAlexander von Gluck IV   GLUTwindowStatusCB windowStatus;  /* window status */
396da465207SAlexander von Gluck IV   GLUTvisibilityCB visibility;  /* visibility */
397da465207SAlexander von Gluck IV   GLUTspecialCB special;  /* special key */
398da465207SAlexander von Gluck IV   GLUTspecialCB specialUp;  /* special up key */
399da465207SAlexander von Gluck IV   GLUTbuttonBoxCB buttonBox;  /* button box */
400da465207SAlexander von Gluck IV   GLUTdialsCB dials;    /* dials */
401da465207SAlexander von Gluck IV   GLUTspaceMotionCB spaceMotion;  /* Spaceball motion */
402da465207SAlexander von Gluck IV   GLUTspaceRotateCB spaceRotate;  /* Spaceball rotate */
403da465207SAlexander von Gluck IV   GLUTspaceButtonCB spaceButton;  /* Spaceball button */
404da465207SAlexander von Gluck IV   GLUTtabletMotionCB tabletMotion;  /* tablet motion */
405da465207SAlexander von Gluck IV   GLUTtabletButtonCB tabletButton;  /* tablet button */
406da465207SAlexander von Gluck IV #ifdef _WIN32
407da465207SAlexander von Gluck IV   GLUTjoystickCB joystick;  /* joystick */
408da465207SAlexander von Gluck IV   int joyPollInterval; /* joystick polling interval */
409da465207SAlexander von Gluck IV #endif
410da465207SAlexander von Gluck IV #ifdef SUPPORT_FORTRAN
411da465207SAlexander von Gluck IV   /* Special Fortran display  unneeded since no
412da465207SAlexander von Gluck IV      parameters! */
413da465207SAlexander von Gluck IV   GLUTreshapeFCB freshape;  /* Fortran reshape  */
414da465207SAlexander von Gluck IV   GLUTmouseFCB fmouse;  /* Fortran mouse  */
415da465207SAlexander von Gluck IV   GLUTmotionFCB fmotion;  /* Fortran motion  */
416da465207SAlexander von Gluck IV   GLUTpassiveFCB fpassive;  /* Fortran passive  */
417da465207SAlexander von Gluck IV   GLUTentryFCB fentry;  /* Fortran entry  */
418da465207SAlexander von Gluck IV   GLUTkeyboardFCB fkeyboard;  /* Fortran keyboard  */
419da465207SAlexander von Gluck IV   GLUTkeyboardFCB fkeyboardUp;  /* Fortran keyboard up */
420da465207SAlexander von Gluck IV   GLUTwindowStatusFCB fwindowStatus;  /* Fortran visibility
421da465207SAlexander von Gluck IV                                           */
422da465207SAlexander von Gluck IV   GLUTvisibilityFCB fvisibility;  /* Fortran visibility
423da465207SAlexander von Gluck IV                                       */
424da465207SAlexander von Gluck IV   GLUTspecialFCB fspecial;  /* special key */
425da465207SAlexander von Gluck IV   GLUTspecialFCB fspecialUp;  /* special key up */
426da465207SAlexander von Gluck IV   GLUTbuttonBoxFCB fbuttonBox;  /* button box */
427da465207SAlexander von Gluck IV   GLUTdialsFCB fdials;  /* dials */
428da465207SAlexander von Gluck IV   GLUTspaceMotionFCB fspaceMotion;  /* Spaceball motion
429da465207SAlexander von Gluck IV                                         */
430da465207SAlexander von Gluck IV   GLUTspaceRotateFCB fspaceRotate;  /* Spaceball rotate
431da465207SAlexander von Gluck IV                                         */
432da465207SAlexander von Gluck IV   GLUTspaceButtonFCB fspaceButton;  /* Spaceball button
433da465207SAlexander von Gluck IV                                         */
434da465207SAlexander von Gluck IV   GLUTtabletMotionFCB ftabletMotion;  /* tablet motion
435da465207SAlexander von Gluck IV                                        */
436da465207SAlexander von Gluck IV   GLUTtabletButtonFCB ftabletButton;  /* tablet button
437da465207SAlexander von Gluck IV                                        */
438da465207SAlexander von Gluck IV #ifdef _WIN32
439da465207SAlexander von Gluck IV   GLUTjoystickFCB fjoystick;  /* joystick */
440da465207SAlexander von Gluck IV #endif
441da465207SAlexander von Gluck IV #endif
442da465207SAlexander von Gluck IV };
443da465207SAlexander von Gluck IV 
444da465207SAlexander von Gluck IV struct _GLUToverlay {
445da465207SAlexander von Gluck IV #if defined(_WIN32)
446da465207SAlexander von Gluck IV   int pf;
447da465207SAlexander von Gluck IV   HDC hdc;
448da465207SAlexander von Gluck IV #endif
449da465207SAlexander von Gluck IV   Window win;
450da465207SAlexander von Gluck IV   GLXContext ctx;
451da465207SAlexander von Gluck IV   XVisualInfo *vis;     /* visual for window */
452da465207SAlexander von Gluck IV   Bool visAlloced;      /* if vis needs deallocate on destroy */
453da465207SAlexander von Gluck IV   Colormap cmap;        /* RGB colormap for window; None if CI */
454da465207SAlexander von Gluck IV   GLUTcolormap *colormap;  /* colormap; NULL if RGBA */
455da465207SAlexander von Gluck IV   int shownState;       /* if overlay window mapped */
456da465207SAlexander von Gluck IV   Bool treatAsSingle;   /* treat as single-buffered */
457da465207SAlexander von Gluck IV #if !defined(_WIN32)
458da465207SAlexander von Gluck IV   Bool isDirect;        /* if direct context */
459da465207SAlexander von Gluck IV #endif
460da465207SAlexander von Gluck IV   int transparentPixel; /* transparent pixel value */
461da465207SAlexander von Gluck IV   GLUTdisplayCB display;  /* redraw  */
462da465207SAlexander von Gluck IV   /* Special Fortran display  unneeded since no
463da465207SAlexander von Gluck IV      parameters! */
464da465207SAlexander von Gluck IV };
465da465207SAlexander von Gluck IV 
466da465207SAlexander von Gluck IV typedef struct _GLUTstale GLUTstale;
467da465207SAlexander von Gluck IV struct _GLUTstale {
468da465207SAlexander von Gluck IV   GLUTwindow *window;
469da465207SAlexander von Gluck IV   Window win;
470da465207SAlexander von Gluck IV   GLUTstale *next;
471da465207SAlexander von Gluck IV };
472da465207SAlexander von Gluck IV 
473da465207SAlexander von Gluck IV extern GLUTstale *__glutStaleWindowList;
474da465207SAlexander von Gluck IV 
475da465207SAlexander von Gluck IV #define GLUT_OVERLAY_EVENT_FILTER_MASK \
476da465207SAlexander von Gluck IV   (ExposureMask | \
477da465207SAlexander von Gluck IV   StructureNotifyMask | \
478da465207SAlexander von Gluck IV   EnterWindowMask | \
479da465207SAlexander von Gluck IV   LeaveWindowMask)
480da465207SAlexander von Gluck IV #define GLUT_DONT_PROPAGATE_FILTER_MASK \
481da465207SAlexander von Gluck IV   (ButtonReleaseMask | \
482da465207SAlexander von Gluck IV   ButtonPressMask | \
483da465207SAlexander von Gluck IV   KeyPressMask | \
484da465207SAlexander von Gluck IV   KeyReleaseMask | \
485da465207SAlexander von Gluck IV   PointerMotionMask | \
486da465207SAlexander von Gluck IV   Button1MotionMask | \
487da465207SAlexander von Gluck IV   Button2MotionMask | \
488da465207SAlexander von Gluck IV   Button3MotionMask)
489da465207SAlexander von Gluck IV #define GLUT_HACK_STOP_PROPAGATE_MASK \
490da465207SAlexander von Gluck IV   (KeyPressMask | \
491da465207SAlexander von Gluck IV   KeyReleaseMask)
492da465207SAlexander von Gluck IV 
493da465207SAlexander von Gluck IV typedef struct _GLUTmenu GLUTmenu;
494da465207SAlexander von Gluck IV typedef struct _GLUTmenuItem GLUTmenuItem;
495da465207SAlexander von Gluck IV struct _GLUTmenu {
496da465207SAlexander von Gluck IV   int id;               /* small integer menu id (0-based) */
497da465207SAlexander von Gluck IV   Window win;           /* X window for the menu */
498da465207SAlexander von Gluck IV   GLUTselectCB select;  /*  function of menu */
499da465207SAlexander von Gluck IV   GLUTmenuItem *list;   /* list of menu entries */
500da465207SAlexander von Gluck IV   int num;              /* number of entries */
501da465207SAlexander von Gluck IV #if !defined(_WIN32)
502da465207SAlexander von Gluck IV   Bool managed;         /* are the InputOnly windows size
503da465207SAlexander von Gluck IV                            validated? */
504da465207SAlexander von Gluck IV   Bool searched;	/* help detect menu loops */
505da465207SAlexander von Gluck IV   int pixheight;        /* height of menu in pixels */
506da465207SAlexander von Gluck IV   int pixwidth;         /* width of menu in pixels */
507da465207SAlexander von Gluck IV #endif
508da465207SAlexander von Gluck IV   int submenus;         /* number of submenu entries */
509da465207SAlexander von Gluck IV   GLUTmenuItem *highlighted;  /* pointer to highlighted menu
510da465207SAlexander von Gluck IV                                  entry, NULL not highlighted */
511da465207SAlexander von Gluck IV   GLUTmenu *cascade;    /* currently cascading this menu  */
512da465207SAlexander von Gluck IV   GLUTmenuItem *anchor; /* currently anchored to this entry */
513da465207SAlexander von Gluck IV   int x;                /* current x origin relative to the
514da465207SAlexander von Gluck IV                            root window */
515da465207SAlexander von Gluck IV   int y;                /* current y origin relative to the
516da465207SAlexander von Gluck IV                            root window */
517da465207SAlexander von Gluck IV #ifdef SUPPORT_FORTRAN
518da465207SAlexander von Gluck IV   GLUTselectFCB fselect;  /*  function of menu */
519da465207SAlexander von Gluck IV #endif
520da465207SAlexander von Gluck IV };
521da465207SAlexander von Gluck IV 
522da465207SAlexander von Gluck IV struct _GLUTmenuItem {
523da465207SAlexander von Gluck IV   Window win;           /* InputOnly X window for entry */
524da465207SAlexander von Gluck IV   GLUTmenu *menu;       /* menu entry belongs to */
525da465207SAlexander von Gluck IV   Bool isTrigger;       /* is a submenu trigger? */
526da465207SAlexander von Gluck IV   int value;            /* value to return for selecting this
527da465207SAlexander von Gluck IV                            entry; doubles as submenu id
528da465207SAlexander von Gluck IV                            (0-base) if submenu trigger */
529da465207SAlexander von Gluck IV #if defined(_WIN32)
530da465207SAlexander von Gluck IV   UINT unique;          /* unique menu item id (Win32 only) */
531da465207SAlexander von Gluck IV #endif
532da465207SAlexander von Gluck IV   char *label;          /* __glutStrdup'ed label string */
533da465207SAlexander von Gluck IV   int len;              /* length of label string */
534da465207SAlexander von Gluck IV   int pixwidth;         /* width of X window in pixels */
535da465207SAlexander von Gluck IV   GLUTmenuItem *next;   /* next menu entry on list for menu */
536da465207SAlexander von Gluck IV };
537da465207SAlexander von Gluck IV 
538da465207SAlexander von Gluck IV typedef struct _GLUTtimer GLUTtimer;
539da465207SAlexander von Gluck IV struct _GLUTtimer {
540da465207SAlexander von Gluck IV   GLUTtimer *next;      /* list of timers */
541da465207SAlexander von Gluck IV   struct timeval timeout;  /* time to be called */
542da465207SAlexander von Gluck IV   GLUTtimerCB func;     /* timer  (value) */
543da465207SAlexander von Gluck IV   int value;            /*  return value */
544da465207SAlexander von Gluck IV #ifdef SUPPORT_FORTRAN
545da465207SAlexander von Gluck IV   GLUTtimerFCB ffunc;   /* Fortran timer  */
546da465207SAlexander von Gluck IV #endif
547da465207SAlexander von Gluck IV };
548da465207SAlexander von Gluck IV 
549da465207SAlexander von Gluck IV typedef struct _GLUTeventParser GLUTeventParser;
550da465207SAlexander von Gluck IV struct _GLUTeventParser {
551da465207SAlexander von Gluck IV   int (*func) (XEvent *);
552da465207SAlexander von Gluck IV   GLUTeventParser *next;
553da465207SAlexander von Gluck IV };
554da465207SAlexander von Gluck IV 
555da465207SAlexander von Gluck IV /* Declarations to implement glutFullScreen support with
556da465207SAlexander von Gluck IV    mwm/4Dwm. */
557da465207SAlexander von Gluck IV 
558da465207SAlexander von Gluck IV /* The following X property format is defined in Motif 1.1's
559da465207SAlexander von Gluck IV    Xm/MwmUtils.h, but GLUT should not depend on that header
560da465207SAlexander von Gluck IV    file. Note: Motif 1.2 expanded this structure with
561da465207SAlexander von Gluck IV    uninteresting fields (to GLUT) so just stick with the
562da465207SAlexander von Gluck IV    smaller Motif 1.1 structure. */
563da465207SAlexander von Gluck IV typedef struct {
564da465207SAlexander von Gluck IV #define MWM_HINTS_DECORATIONS   2
565da465207SAlexander von Gluck IV   long flags;
566da465207SAlexander von Gluck IV   long functions;
567da465207SAlexander von Gluck IV   long decorations;
568da465207SAlexander von Gluck IV   long input_mode;
569da465207SAlexander von Gluck IV } MotifWmHints;
570da465207SAlexander von Gluck IV 
571da465207SAlexander von Gluck IV /* Make current and buffer swap macros. */
572da465207SAlexander von Gluck IV #ifdef _WIN32
573da465207SAlexander von Gluck IV #define MAKE_CURRENT_LAYER(window)                                    \
574da465207SAlexander von Gluck IV   {                                                                   \
575da465207SAlexander von Gluck IV     HGLRC currentContext = wglGetCurrentContext();                    \
576da465207SAlexander von Gluck IV     HDC currentDc = wglGetCurrentDC();                                \
577da465207SAlexander von Gluck IV                                                                       \
578da465207SAlexander von Gluck IV     if (currentContext != window->renderCtx                           \
579da465207SAlexander von Gluck IV       || currentDc != window->renderDc) {                             \
580da465207SAlexander von Gluck IV       wglMakeCurrent(window->renderDc, window->renderCtx);            \
581da465207SAlexander von Gluck IV     }                                                                 \
582da465207SAlexander von Gluck IV   }
583da465207SAlexander von Gluck IV #define MAKE_CURRENT_WINDOW(window)                                   \
584da465207SAlexander von Gluck IV   {                                                                   \
585da465207SAlexander von Gluck IV     HGLRC currentContext = wglGetCurrentContext();                    \
586da465207SAlexander von Gluck IV     HDC currentDc = wglGetCurrentDC();                                \
587da465207SAlexander von Gluck IV                                                                       \
588da465207SAlexander von Gluck IV     if (currentContext != window->ctx || currentDc != window->hdc) {  \
589da465207SAlexander von Gluck IV       wglMakeCurrent(window->hdc, window->ctx);                       \
590da465207SAlexander von Gluck IV     }                                                                 \
591da465207SAlexander von Gluck IV   }
592da465207SAlexander von Gluck IV #define MAKE_CURRENT_OVERLAY(overlay) \
593da465207SAlexander von Gluck IV   wglMakeCurrent(overlay->hdc, overlay->ctx)
594da465207SAlexander von Gluck IV #define UNMAKE_CURRENT() \
595da465207SAlexander von Gluck IV   wglMakeCurrent(NULL, NULL)
596da465207SAlexander von Gluck IV #define SWAP_BUFFERS_WINDOW(window) \
597da465207SAlexander von Gluck IV   SwapBuffers(window->hdc)
598da465207SAlexander von Gluck IV #define SWAP_BUFFERS_LAYER(window) \
599da465207SAlexander von Gluck IV   SwapBuffers(window->renderDc)
600da465207SAlexander von Gluck IV #else
601da465207SAlexander von Gluck IV #define MAKE_CURRENT_LAYER(window) \
602da465207SAlexander von Gluck IV   glXMakeCurrent(__glutDisplay, window->renderWin, window->renderCtx)
603da465207SAlexander von Gluck IV #define MAKE_CURRENT_WINDOW(window) \
604da465207SAlexander von Gluck IV   glXMakeCurrent(__glutDisplay, window->win, window->ctx)
605da465207SAlexander von Gluck IV #define MAKE_CURRENT_OVERLAY(overlay) \
606da465207SAlexander von Gluck IV   glXMakeCurrent(__glutDisplay, overlay->win, overlay->ctx)
607da465207SAlexander von Gluck IV #define UNMAKE_CURRENT() \
608da465207SAlexander von Gluck IV   glXMakeCurrent(__glutDisplay, None, NULL)
609da465207SAlexander von Gluck IV #define SWAP_BUFFERS_WINDOW(window) \
610da465207SAlexander von Gluck IV   glXSwapBuffers(__glutDisplay, window->win)
611da465207SAlexander von Gluck IV #define SWAP_BUFFERS_LAYER(window) \
612da465207SAlexander von Gluck IV   glXSwapBuffers(__glutDisplay, window->renderWin)
613da465207SAlexander von Gluck IV #endif
614da465207SAlexander von Gluck IV 
615da465207SAlexander von Gluck IV /* private variables from glut_event.c */
616da465207SAlexander von Gluck IV extern GLUTwindow *__glutWindowWorkList;
617da465207SAlexander von Gluck IV extern int __glutWindowDamaged;
618da465207SAlexander von Gluck IV #ifdef SUPPORT_FORTRAN
619da465207SAlexander von Gluck IV extern GLUTtimer *__glutTimerList;
620da465207SAlexander von Gluck IV extern GLUTtimer *__glutNewTimer;
621da465207SAlexander von Gluck IV #endif
622da465207SAlexander von Gluck IV extern GLUTmenu *__glutMappedMenu;
623da465207SAlexander von Gluck IV 
624da465207SAlexander von Gluck IV extern void (*__glutUpdateInputDeviceMaskFunc) (GLUTwindow *);
625da465207SAlexander von Gluck IV #if !defined(_WIN32)
626da465207SAlexander von Gluck IV extern void (*__glutMenuItemEnterOrLeave)(GLUTmenuItem * item,
627da465207SAlexander von Gluck IV   int num, int type);
628da465207SAlexander von Gluck IV extern void (*__glutFinishMenu)(Window win, int x, int y);
629da465207SAlexander von Gluck IV extern void (*__glutPaintMenu)(GLUTmenu * menu);
630da465207SAlexander von Gluck IV extern void (*__glutStartMenu)(GLUTmenu * menu,
631da465207SAlexander von Gluck IV   GLUTwindow * window, int x, int y, int x_win, int y_win);
632da465207SAlexander von Gluck IV extern GLUTmenu * (*__glutGetMenuByNum)(int menunum);
633da465207SAlexander von Gluck IV extern GLUTmenuItem * (*__glutGetMenuItem)(GLUTmenu * menu,
634da465207SAlexander von Gluck IV   Window win, int *which);
635da465207SAlexander von Gluck IV extern GLUTmenu * (*__glutGetMenu)(Window win);
636da465207SAlexander von Gluck IV #endif
637da465207SAlexander von Gluck IV 
638da465207SAlexander von Gluck IV /* private variables from glut_init.c */
639da465207SAlexander von Gluck IV extern Atom __glutWMDeleteWindow;
640da465207SAlexander von Gluck IV extern Display *__glutDisplay;
641da465207SAlexander von Gluck IV extern unsigned int __glutDisplayMode;
642da465207SAlexander von Gluck IV extern char *__glutDisplayString;
643da465207SAlexander von Gluck IV extern XVisualInfo *(*__glutDetermineVisualFromString) (char *string, Bool * treatAsSingle,
644da465207SAlexander von Gluck IV   Criterion * requiredCriteria, int nRequired, int requiredMask, void **fbc);
645da465207SAlexander von Gluck IV extern GLboolean __glutDebug;
646da465207SAlexander von Gluck IV extern GLboolean __glutForceDirect;
647da465207SAlexander von Gluck IV extern GLboolean __glutIconic;
648da465207SAlexander von Gluck IV extern GLboolean __glutTryDirect;
649da465207SAlexander von Gluck IV extern Window __glutRoot;
650da465207SAlexander von Gluck IV extern XSizeHints __glutSizeHints;
651da465207SAlexander von Gluck IV extern char **__glutArgv;
652da465207SAlexander von Gluck IV #endif  /* BeOS */
653da465207SAlexander von Gluck IV extern char *__glutProgramName;
654da465207SAlexander von Gluck IV #if (!defined(__BEOS__) && !defined(__HAIKU__))
655da465207SAlexander von Gluck IV extern int __glutArgc;
656da465207SAlexander von Gluck IV extern int __glutConnectionFD;
657da465207SAlexander von Gluck IV extern int __glutInitHeight;
658da465207SAlexander von Gluck IV extern int __glutInitWidth;
659da465207SAlexander von Gluck IV extern int __glutInitX;
660da465207SAlexander von Gluck IV extern int __glutInitY;
661da465207SAlexander von Gluck IV extern int __glutScreen;
662da465207SAlexander von Gluck IV extern int __glutScreenHeight;
663da465207SAlexander von Gluck IV extern int __glutScreenWidth;
664da465207SAlexander von Gluck IV extern Atom __glutMotifHints;
665da465207SAlexander von Gluck IV extern unsigned int __glutModifierMask;
666da465207SAlexander von Gluck IV 
667da465207SAlexander von Gluck IV /* private variables from glut_menu.c */
668da465207SAlexander von Gluck IV extern GLUTmenuItem *__glutItemSelected;
669da465207SAlexander von Gluck IV extern GLUTmenu **__glutMenuList;
670da465207SAlexander von Gluck IV extern void (*__glutMenuStatusFunc) (int, int, int);
671da465207SAlexander von Gluck IV extern void __glutMenuModificationError(void);
672da465207SAlexander von Gluck IV extern void __glutSetMenuItem(GLUTmenuItem * item,
673da465207SAlexander von Gluck IV   const char *label, int value, Bool isTrigger);
674da465207SAlexander von Gluck IV 
675da465207SAlexander von Gluck IV /* private variables from glut_win.c */
676da465207SAlexander von Gluck IV extern GLUTwindow **__glutWindowList;
677da465207SAlexander von Gluck IV extern GLUTwindow *__glutCurrentWindow;
678da465207SAlexander von Gluck IV extern GLUTwindow *__glutMenuWindow;
679da465207SAlexander von Gluck IV extern GLUTmenu *__glutCurrentMenu;
680da465207SAlexander von Gluck IV extern int __glutWindowListSize;
681da465207SAlexander von Gluck IV extern void (*__glutFreeOverlayFunc) (GLUToverlay *);
682da465207SAlexander von Gluck IV extern XVisualInfo *__glutDetermineWindowVisual(Bool * treatAsSingle,
683da465207SAlexander von Gluck IV   Bool * visAlloced, void **fbc);
684da465207SAlexander von Gluck IV 
685da465207SAlexander von Gluck IV /* private variables from glut_mesa.c */
686da465207SAlexander von Gluck IV extern int __glutMesaSwapHackSupport;
687da465207SAlexander von Gluck IV 
688da465207SAlexander von Gluck IV /* private variables from glut_gamemode.c */
689da465207SAlexander von Gluck IV extern GLUTwindow *__glutGameModeWindow;
690da465207SAlexander von Gluck IV 
691da465207SAlexander von Gluck IV /* private routines from glut_cindex.c */
692da465207SAlexander von Gluck IV extern GLUTcolormap * __glutAssociateNewColormap(XVisualInfo * vis);
693da465207SAlexander von Gluck IV extern void __glutFreeColormap(GLUTcolormap *);
694da465207SAlexander von Gluck IV 
695da465207SAlexander von Gluck IV /* private routines from glut_cmap.c */
696da465207SAlexander von Gluck IV extern void __glutSetupColormap(
697da465207SAlexander von Gluck IV   XVisualInfo * vi,
698da465207SAlexander von Gluck IV   GLUTcolormap ** colormap,
699da465207SAlexander von Gluck IV   Colormap * cmap);
700da465207SAlexander von Gluck IV #if !defined(_WIN32)
701da465207SAlexander von Gluck IV extern void __glutEstablishColormapsProperty(
702da465207SAlexander von Gluck IV   GLUTwindow * window);
703da465207SAlexander von Gluck IV extern GLUTwindow *__glutToplevelOf(GLUTwindow * window);
704da465207SAlexander von Gluck IV #endif
705da465207SAlexander von Gluck IV 
706da465207SAlexander von Gluck IV /* private routines from glut_cursor.c */
707da465207SAlexander von Gluck IV extern void __glutSetCursor(GLUTwindow *window);
708da465207SAlexander von Gluck IV 
709da465207SAlexander von Gluck IV /* private routines from glut_event.c */
710da465207SAlexander von Gluck IV extern void __glutPutOnWorkList(GLUTwindow * window,
711da465207SAlexander von Gluck IV   int work_mask);
712da465207SAlexander von Gluck IV extern void __glutRegisterEventParser(GLUTeventParser * parser);
713da465207SAlexander von Gluck IV extern void __glutPostRedisplay(GLUTwindow * window, int layerMask);
714da465207SAlexander von Gluck IV 
715da465207SAlexander von Gluck IV /* private routines from glut_init.c */
716da465207SAlexander von Gluck IV #if !defined(_WIN32)
717da465207SAlexander von Gluck IV extern void __glutOpenXConnection(char *display);
718da465207SAlexander von Gluck IV #else
719da465207SAlexander von Gluck IV extern void __glutOpenWin32Connection(char *display);
720da465207SAlexander von Gluck IV #endif
721da465207SAlexander von Gluck IV extern void __glutInitTime(struct timeval *beginning);
722da465207SAlexander von Gluck IV 
723da465207SAlexander von Gluck IV /* private routines for glut_menu.c (or win32_menu.c) */
724da465207SAlexander von Gluck IV #if defined(_WIN32)
725da465207SAlexander von Gluck IV extern GLUTmenu *__glutGetMenu(Window win);
726da465207SAlexander von Gluck IV extern GLUTmenu *__glutGetMenuByNum(int menunum);
727da465207SAlexander von Gluck IV extern GLUTmenuItem *__glutGetMenuItem(GLUTmenu * menu,
728da465207SAlexander von Gluck IV   Window win, int *which);
729da465207SAlexander von Gluck IV extern void __glutStartMenu(GLUTmenu * menu,
730da465207SAlexander von Gluck IV   GLUTwindow * window, int x, int y, int x_win, int y_win);
731da465207SAlexander von Gluck IV extern void __glutFinishMenu(Window win, int x, int y);
732da465207SAlexander von Gluck IV #endif
733da465207SAlexander von Gluck IV extern void __glutSetMenu(GLUTmenu * menu);
734da465207SAlexander von Gluck IV 
735da465207SAlexander von Gluck IV #endif  /* BeOS */
736da465207SAlexander von Gluck IV #ifdef __cplusplus
737da465207SAlexander von Gluck IV extern "C" {
738da465207SAlexander von Gluck IV #endif
739da465207SAlexander von Gluck IV /* private routines from glut_util.c */
740da465207SAlexander von Gluck IV extern char * __glutStrdup(const char *string);
741da465207SAlexander von Gluck IV extern void __glutWarning(const char *format,...);
742da465207SAlexander von Gluck IV extern void __glutFatalError(const char *format,...);
743da465207SAlexander von Gluck IV extern void __glutFatalUsage(const char *format,...);
744da465207SAlexander von Gluck IV #ifdef __cplusplus
745da465207SAlexander von Gluck IV }
746da465207SAlexander von Gluck IV #endif
747da465207SAlexander von Gluck IV #if (!defined(__BEOS__) && !defined(__HAIKU__))
748da465207SAlexander von Gluck IV 
749da465207SAlexander von Gluck IV /* private routines from glut_win.c */
750da465207SAlexander von Gluck IV extern GLUTwindow *__glutGetWindow(Window win);
751da465207SAlexander von Gluck IV extern void __glutChangeWindowEventMask(long mask, Bool add);
752da465207SAlexander von Gluck IV extern XVisualInfo *__glutDetermineVisual(
753da465207SAlexander von Gluck IV   unsigned int mode,
754da465207SAlexander von Gluck IV   Bool * fakeSingle,
755da465207SAlexander von Gluck IV   XVisualInfo * (getVisualInfo) (unsigned int));
756da465207SAlexander von Gluck IV extern XVisualInfo *__glutGetVisualInfo(unsigned int mode);
757da465207SAlexander von Gluck IV extern void __glutSetWindow(GLUTwindow * window);
758da465207SAlexander von Gluck IV extern void __glutReshapeFunc(GLUTreshapeCB reshapeFunc,
759da465207SAlexander von Gluck IV   int callingConvention);
760da465207SAlexander von Gluck IV extern void  __glutDefaultReshape(int, int);
761da465207SAlexander von Gluck IV extern GLUTwindow *__glutCreateWindow(
762da465207SAlexander von Gluck IV   GLUTwindow * parent,
763da465207SAlexander von Gluck IV   int x, int y, int width, int height, int gamemode);
764da465207SAlexander von Gluck IV extern void __glutDestroyWindow(
765da465207SAlexander von Gluck IV   GLUTwindow * window,
766da465207SAlexander von Gluck IV   GLUTwindow * initialWindow);
767da465207SAlexander von Gluck IV 
768da465207SAlexander von Gluck IV #if !defined(_WIN32)
769da465207SAlexander von Gluck IV /* private routines from glut_glxext.c */
770da465207SAlexander von Gluck IV extern int __glutIsSupportedByGLX(char *);
771da465207SAlexander von Gluck IV #endif
772da465207SAlexander von Gluck IV 
773da465207SAlexander von Gluck IV /* private routines from glut_input.c */
774da465207SAlexander von Gluck IV extern void  __glutUpdateInputDeviceMask(GLUTwindow * window);
775da465207SAlexander von Gluck IV 
776da465207SAlexander von Gluck IV /* private routines from glut_mesa.c */
777da465207SAlexander von Gluck IV extern void __glutDetermineMesaSwapHackSupport(void);
778da465207SAlexander von Gluck IV 
779da465207SAlexander von Gluck IV /* private routines from glut_gameglut.c */
780da465207SAlexander von Gluck IV extern void __glutCloseDownGameMode(void);
781da465207SAlexander von Gluck IV 
782da465207SAlexander von Gluck IV #if defined(_WIN32)
783da465207SAlexander von Gluck IV /* private routines from win32_*.c */
784da465207SAlexander von Gluck IV extern LONG WINAPI __glutWindowProc(HWND win, UINT msg, WPARAM w, LPARAM l);
785da465207SAlexander von Gluck IV extern HDC XHDC;
786da465207SAlexander von Gluck IV #endif
787da465207SAlexander von Gluck IV 
788da465207SAlexander von Gluck IV #else  /* BeOS */
789da465207SAlexander von Gluck IV /* BeOS specific C++ function prototypes */
790da465207SAlexander von Gluck IV #ifdef __cplusplus
791da465207SAlexander von Gluck IV 
792da465207SAlexander von Gluck IV #include <SupportDefs.h>
793da465207SAlexander von Gluck IV 
794da465207SAlexander von Gluck IV /* private routines from glutInit.cpp */
795da465207SAlexander von Gluck IV void __glutInitTime(bigtime_t *beginning);
796da465207SAlexander von Gluck IV void __glutInit();
797da465207SAlexander von Gluck IV void __glutExitCleanup();
798da465207SAlexander von Gluck IV 
799da465207SAlexander von Gluck IV /* private routines from glutMenu.cpp */
800da465207SAlexander von Gluck IV class GlutMenu;         // avoid including glutMenu.h
801da465207SAlexander von Gluck IV GlutMenu *__glutGetMenuByNum(int menunum);
802da465207SAlexander von Gluck IV 
803da465207SAlexander von Gluck IV /* private routines from glutWindow.cpp */
804da465207SAlexander von Gluck IV int __glutConvertDisplayMode(unsigned long *options);
805da465207SAlexander von Gluck IV void __glutDefaultReshape(int width, int height);
806da465207SAlexander von Gluck IV class GlutWindow;       // avoid including glutWindow.h in every source file
807da465207SAlexander von Gluck IV void __glutSetWindow(GlutWindow * window);
808da465207SAlexander von Gluck IV void __glutDestroyAllWindows();
809da465207SAlexander von Gluck IV 
810da465207SAlexander von Gluck IV /* private routines from glutDstr.cpp */
811da465207SAlexander von Gluck IV int __glutConvertDisplayModeFromString(unsigned long *options);
812da465207SAlexander von Gluck IV 
813da465207SAlexander von Gluck IV /* private routines from glutCursor.cpp */
814da465207SAlexander von Gluck IV void __glutSetCursor(int cursor);
815da465207SAlexander von Gluck IV 
816da465207SAlexander von Gluck IV #endif /* __cplusplus */
817da465207SAlexander von Gluck IV #endif  /* BeOS */
818da465207SAlexander von Gluck IV 
819da465207SAlexander von Gluck IV #endif /* __glutint_h__ */
820