4 /* Copyright (c) Mark J. Kilgard, 1994, 1997, 1998. */
6 /* This program is freely distributable without licensing fees
7 and is provided without guarantee or warrantee expressed or
8 implied. This program is -not- in the public domain. */
11 #include <GL/vms_x_fix.h>
14 #if defined(__CYGWIN32__)
18 #define SUPPORT_FORTRAN /* With GLUT 3.7, everyone supports Fortran. */
21 #include "glutwin32.h"
24 #include <X11/Xutil.h>
25 #define GLX_GLXEXT_PROTOTYPES
29 #ifndef GLUT_BUILDING_LIB
30 #define GLUT_BUILDING_LIB /* Building the GLUT library itself. */
36 /* added by BrianP: */
38 #define APIENTRY GLAPIENTRY
40 #define __cdecl GLAPIENTRY
41 #define CDECL GLAPIENTRY
44 /* GLUT_BUILDING_LIB is used by <GL/glut.h> to 1) not #pragma link
45 with the GLUT library, and 2) avoid the Win32 atexit hack. */
47 #ifdef SUPPORT_FORTRAN
48 #include <GL/glutf90.h>
52 #if ( __VMS_VER < 70000000 )
57 extern int sys$
gettim(struct timeval6
*);
62 #include <sys/types.h>
63 #if !defined(_WIN32) || defined(__CYGWIN32__)
69 #if defined(__vms) && ( __VMS_VER < 70000000 )
71 /* For VMS6.2 or lower :
72 One TICK on VMS is 100 nanoseconds; 0.1 microseconds or
73 0.0001 milliseconds. This means that there are 0.01
74 ticks/ns, 10 ticks/us, 10,000 ticks/ms and 10,000,000
77 #define TICKS_PER_MILLISECOND 10000
78 #define TICKS_PER_SECOND 10000000
80 #define GETTIMEOFDAY(_x) (void) sys$gettim (_x);
82 #define ADD_TIME(dest, src1, src2) { \
83 (dest).val = (src1).val + (src2).val; \
86 #define TIMEDELTA(dest, src1, src2) { \
87 (dest).val = (src1).val - (src2).val; \
90 #define IS_AFTER(t1, t2) ((t2).val > (t1).val)
92 #define IS_AT_OR_AFTER(t1, t2) ((t2).val >= (t1).val)
95 #if defined(SVR4) && !defined(sun) /* Sun claims SVR4, but
97 #define GETTIMEOFDAY(_x) gettimeofday(_x)
99 #define GETTIMEOFDAY(_x) gettimeofday(_x, NULL)
101 #define ADD_TIME(dest, src1, src2) { \
102 if(((dest).tv_usec = \
103 (src1).tv_usec + (src2).tv_usec) >= 1000000) { \
104 (dest).tv_usec -= 1000000; \
105 (dest).tv_sec = (src1).tv_sec + (src2).tv_sec + 1; \
107 (dest).tv_sec = (src1).tv_sec + (src2).tv_sec; \
108 if(((dest).tv_sec >= 1) && (((dest).tv_usec <0))) { \
109 (dest).tv_sec --;(dest).tv_usec += 1000000; \
113 #define TIMEDELTA(dest, src1, src2) { \
114 if(((dest).tv_usec = (src1).tv_usec - (src2).tv_usec) < 0) { \
115 (dest).tv_usec += 1000000; \
116 (dest).tv_sec = (src1).tv_sec - (src2).tv_sec - 1; \
118 (dest).tv_sec = (src1).tv_sec - (src2).tv_sec; \
121 #define IS_AFTER(t1, t2) \
122 (((t2).tv_sec > (t1).tv_sec) || \
123 (((t2).tv_sec == (t1).tv_sec) && \
124 ((t2).tv_usec > (t1).tv_usec)))
125 #define IS_AT_OR_AFTER(t1, t2) \
126 (((t2).tv_sec > (t1).tv_sec) || \
127 (((t2).tv_sec == (t1).tv_sec) && \
128 ((t2).tv_usec >= (t1).tv_usec)))
131 #define IGNORE_IN_GAME_MODE() \
132 { if (__glutGameModeWindow) return; }
134 #define GLUT_WIND_IS_RGB(x) (((x) & GLUT_INDEX) == 0)
135 #define GLUT_WIND_IS_INDEX(x) (((x) & GLUT_INDEX) != 0)
136 #define GLUT_WIND_IS_SINGLE(x) (((x) & GLUT_DOUBLE) == 0)
137 #define GLUT_WIND_IS_DOUBLE(x) (((x) & GLUT_DOUBLE) != 0)
138 #define GLUT_WIND_HAS_ACCUM(x) (((x) & GLUT_ACCUM) != 0)
139 #define GLUT_WIND_HAS_ALPHA(x) (((x) & GLUT_ALPHA) != 0)
140 #define GLUT_WIND_HAS_DEPTH(x) (((x) & GLUT_DEPTH) != 0)
141 #define GLUT_WIND_HAS_STENCIL(x) (((x) & GLUT_STENCIL) != 0)
142 #define GLUT_WIND_IS_MULTISAMPLE(x) (((x) & GLUT_MULTISAMPLE) != 0)
143 #define GLUT_WIND_IS_STEREO(x) (((x) & GLUT_STEREO) != 0)
144 #define GLUT_WIND_IS_LUMINANCE(x) (((x) & GLUT_LUMINANCE) != 0)
145 #define GLUT_MAP_WORK (1 << 0)
146 #define GLUT_EVENT_MASK_WORK (1 << 1)
147 #define GLUT_REDISPLAY_WORK (1 << 2)
148 #define GLUT_CONFIGURE_WORK (1 << 3)
149 #define GLUT_COLORMAP_WORK (1 << 4)
150 #define GLUT_DEVICE_MASK_WORK (1 << 5)
151 #define GLUT_FINISH_WORK (1 << 6)
152 #define GLUT_DEBUG_WORK (1 << 7)
153 #define GLUT_DUMMY_WORK (1 << 8)
154 #define GLUT_FULL_SCREEN_WORK (1 << 9)
155 #define GLUT_OVERLAY_REDISPLAY_WORK (1 << 10)
156 #define GLUT_REPAIR_WORK (1 << 11)
157 #define GLUT_OVERLAY_REPAIR_WORK (1 << 12)
159 /* Frame buffer capability macros and types. */
161 #define BUFFER_SIZE 1
162 #define DOUBLEBUFFER 2
164 #define AUX_BUFFERS 4
165 #define RED_SIZE 5 /* Used as mask bit for
171 #define STENCIL_SIZE 10
172 #define ACCUM_RED_SIZE 11 /* Used as mask bit for
174 #define ACCUM_GREEN_SIZE 12
175 #define ACCUM_BLUE_SIZE 13
176 #define ACCUM_ALPHA_SIZE 14
179 #define NUM_GLXCAPS (LEVEL + 1)
181 #define XVISUAL (NUM_GLXCAPS + 0)
182 #define TRANSPARENT (NUM_GLXCAPS + 1)
183 #define SAMPLES (NUM_GLXCAPS + 2)
184 #define XSTATICGRAY (NUM_GLXCAPS + 3) /* Used as
189 #define XGRAYSCALE (NUM_GLXCAPS + 4)
190 #define XSTATICCOLOR (NUM_GLXCAPS + 5)
191 #define XPSEUDOCOLOR (NUM_GLXCAPS + 6)
192 #define XTRUECOLOR (NUM_GLXCAPS + 7)
193 #define XDIRECTCOLOR (NUM_GLXCAPS + 8)
194 #define SLOW (NUM_GLXCAPS + 9)
195 #define CONFORMANT (NUM_GLXCAPS + 10)
197 #define NUM_CAPS (NUM_GLXCAPS + 11)
199 /* Frame buffer capablities that don't have a corresponding
200 FrameBufferMode entry. These get used as mask bits. */
201 #define NUM (NUM_CAPS + 0)
202 #define RGBA_MODE (NUM_CAPS + 1)
203 #define CI_MODE (NUM_CAPS + 2)
204 #define LUMINANCE_MODE (NUM_CAPS + 3)
215 typedef struct _Criterion
{
221 typedef struct _FrameBufferMode
{
223 #if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig)
225 /* fbc is non-NULL when the XVisualInfo* is not OpenGL-capable
226 (ie, GLX_USE_GL is false), but the SGIX_fbconfig extension shows
227 the visual's fbconfig is OpenGL-capable. The reason for this is typically
228 an RGBA luminance fbconfig such as 16-bit StaticGray that could
229 not be advertised as a GLX visual since StaticGray visuals are
230 required (by the GLX specification) to be color index. The
231 SGIX_fbconfig allows StaticGray visuals to instead advertised as
232 fbconfigs that can provide RGBA luminance support. */
240 /* DisplayMode capability macros for game mode. */
241 #define DM_WIDTH 0 /* "width" */
242 #define DM_HEIGHT 1 /* "height" */
243 #define DM_PIXEL_DEPTH 2 /* "bpp" (bits per pixel) */
244 #define DM_HERTZ 3 /* "hertz" */
245 #define DM_NUM 4 /* "num" */
247 #define NUM_DM_CAPS (DM_NUM+1)
249 typedef struct _DisplayMode
{
253 /* XXX The X Window System does not have a standard
254 mechanism for display setting changes. On SGI
255 systems, GLUT could use the XSGIvc (SGI X video
256 control extension). Perhaps this can be done in
257 a future release of GLUT. */
260 int cap
[NUM_DM_CAPS
];
263 /* GLUT function types */
264 typedef void (GLUTCALLBACK
*GLUTdisplayCB
) (void);
265 typedef void (GLUTCALLBACK
*GLUTreshapeCB
) (int, int);
266 typedef void (GLUTCALLBACK
*GLUTkeyboardCB
) (unsigned char, int, int);
267 typedef void (GLUTCALLBACK
*GLUTmouseCB
) (int, int, int, int);
268 typedef void (GLUTCALLBACK
*GLUTmotionCB
) (int, int);
269 typedef void (GLUTCALLBACK
*GLUTpassiveCB
) (int, int);
270 typedef void (GLUTCALLBACK
*GLUTentryCB
) (int);
271 typedef void (GLUTCALLBACK
*GLUTvisibilityCB
) (int);
272 typedef void (GLUTCALLBACK
*GLUTwindowStatusCB
) (int);
273 typedef void (GLUTCALLBACK
*GLUTidleCB
) (void);
274 typedef void (GLUTCALLBACK
*GLUTtimerCB
) (int);
275 typedef void (GLUTCALLBACK
*GLUTmenuStateCB
) (int); /* DEPRICATED. */
276 typedef void (GLUTCALLBACK
*GLUTmenuStatusCB
) (int, int, int);
277 typedef void (GLUTCALLBACK
*GLUTselectCB
) (int);
278 typedef void (GLUTCALLBACK
*GLUTspecialCB
) (int, int, int);
279 typedef void (GLUTCALLBACK
*GLUTspaceMotionCB
) (int, int, int);
280 typedef void (GLUTCALLBACK
*GLUTspaceRotateCB
) (int, int, int);
281 typedef void (GLUTCALLBACK
*GLUTspaceButtonCB
) (int, int);
282 typedef void (GLUTCALLBACK
*GLUTdialsCB
) (int, int);
283 typedef void (GLUTCALLBACK
*GLUTbuttonBoxCB
) (int, int);
284 typedef void (GLUTCALLBACK
*GLUTtabletMotionCB
) (int, int);
285 typedef void (GLUTCALLBACK
*GLUTtabletButtonCB
) (int, int, int, int);
286 typedef void (GLUTCALLBACK
*GLUTjoystickCB
) (unsigned int buttonMask
, int x
, int y
, int z
);
288 typedef struct _GLUTcolorcell GLUTcolorcell
;
289 struct _GLUTcolorcell
{
290 /* GLUT_RED, GLUT_GREEN, GLUT_BLUE */
291 GLfloat component
[3];
294 typedef struct _GLUTcolormap GLUTcolormap
;
295 struct _GLUTcolormap
{
296 Visual
*visual
; /* visual of the colormap */
297 Colormap cmap
; /* X colormap ID */
298 int refcnt
; /* number of windows using colormap */
299 int size
; /* number of cells in colormap */
300 int transparent
; /* transparent pixel, or -1 if opaque */
301 GLUTcolorcell
*cells
; /* array of cells */
302 GLUTcolormap
*next
; /* next colormap in list */
305 typedef struct _GLUTwindow GLUTwindow
;
306 typedef struct _GLUToverlay GLUToverlay
;
308 int num
; /* Small integer window id (0-based). */
310 /* Window system related state. */
312 int pf
; /* Pixel format. */
313 HDC hdc
; /* Window's Win32 device context. */
315 Window win
; /* X window for GLUT window */
316 GLXContext ctx
; /* OpenGL context GLUT glut window */
317 XVisualInfo
*vis
; /* visual for window */
318 Bool visAlloced
; /* if vis needs deallocate on destroy */
319 Colormap cmap
; /* RGB colormap for window; None if CI */
320 GLUTcolormap
*colormap
; /* colormap; NULL if RGBA */
321 GLUToverlay
*overlay
; /* overlay; NULL if no overlay */
323 HDC renderDc
; /* Win32's device context for rendering. */
325 Window renderWin
; /* X window for rendering (might be
327 GLXContext renderCtx
; /* OpenGL context for rendering (might
329 /* GLUT settable or visible window state. */
330 int width
; /* window width in pixels */
331 int height
; /* window height in pixels */
332 int cursor
; /* cursor name */
333 int visState
; /* visibility state (-1 is unknown) */
334 int shownState
; /* if window mapped */
335 int entryState
; /* entry state (-1 is unknown) */
336 #define GLUT_MAX_MENUS 3
338 int menu
[GLUT_MAX_MENUS
]; /* attatched menu nums */
339 /* Window relationship state. */
340 GLUTwindow
*parent
; /* parent window */
341 GLUTwindow
*children
; /* list of children */
342 GLUTwindow
*siblings
; /* list of siblings */
343 /* Misc. non-API visible (hidden) state. */
344 Bool treatAsSingle
; /* treat this window as single-buffered
345 (it might be "fake" though) */
346 Bool forceReshape
; /* force reshape before display */
348 Bool isDirect
; /* if direct context (X11 only) */
350 Bool usedSwapBuffers
; /* if swap buffers used last display */
351 long eventMask
; /* mask of X events selected for */
352 int buttonUses
; /* number of button uses, ref cnt */
353 int tabletPos
[2]; /* tablet position (-1 is invalid) */
354 /* Work list related state. */
355 unsigned int workMask
; /* mask of window work to be done */
356 GLUTwindow
*prevWorkWin
; /* link list of windows to work on */
357 Bool desiredMapState
; /* how to mapped window if on map work
359 Bool ignoreKeyRepeat
; /* if window ignores autorepeat */
360 int desiredConfMask
; /* mask of desired window configuration
362 int desiredX
; /* desired X location */
363 int desiredY
; /* desired Y location */
364 int desiredWidth
; /* desired window width */
365 int desiredHeight
; /* desired window height */
366 int desiredStack
; /* desired window stack */
367 /* Per-window callbacks. */
368 GLUTdisplayCB display
; /* redraw */
369 GLUTreshapeCB reshape
; /* resize (width,height) */
370 GLUTmouseCB mouse
; /* mouse (button,state,x,y) */
371 GLUTmotionCB motion
; /* motion (x,y) */
372 GLUTpassiveCB passive
; /* passive motion (x,y) */
373 GLUTentryCB entry
; /* window entry/exit (state) */
374 GLUTkeyboardCB keyboard
; /* keyboard (ASCII,x,y) */
375 GLUTkeyboardCB keyboardUp
; /* keyboard up (ASCII,x,y) */
376 GLUTwindowStatusCB windowStatus
; /* window status */
377 GLUTvisibilityCB visibility
; /* visibility */
378 GLUTspecialCB special
; /* special key */
379 GLUTspecialCB specialUp
; /* special up key */
380 GLUTbuttonBoxCB buttonBox
; /* button box */
381 GLUTdialsCB dials
; /* dials */
382 GLUTspaceMotionCB spaceMotion
; /* Spaceball motion */
383 GLUTspaceRotateCB spaceRotate
; /* Spaceball rotate */
384 GLUTspaceButtonCB spaceButton
; /* Spaceball button */
385 GLUTtabletMotionCB tabletMotion
; /* tablet motion */
386 GLUTtabletButtonCB tabletButton
; /* tablet button */
388 GLUTjoystickCB joystick
; /* joystick */
389 int joyPollInterval
; /* joystick polling interval */
391 #ifdef SUPPORT_FORTRAN
392 GLUTdisplayFCB fdisplay
; /* Fortran display */
393 GLUTreshapeFCB freshape
; /* Fortran reshape */
394 GLUTmouseFCB fmouse
; /* Fortran mouse */
395 GLUTmotionFCB fmotion
; /* Fortran motion */
396 GLUTpassiveFCB fpassive
; /* Fortran passive */
397 GLUTentryFCB fentry
; /* Fortran entry */
398 GLUTkeyboardFCB fkeyboard
; /* Fortran keyboard */
399 GLUTkeyboardFCB fkeyboardUp
; /* Fortran keyboard up */
400 GLUTwindowStatusFCB fwindowStatus
; /* Fortran window status */
401 GLUTvisibilityFCB fvisibility
; /* Fortran visibility */
402 GLUTspecialFCB fspecial
; /* special key */
403 GLUTspecialFCB fspecialUp
; /* special key up */
404 GLUTbuttonBoxFCB fbuttonBox
; /* button box */
405 GLUTdialsFCB fdials
; /* dials */
406 GLUTspaceMotionFCB fspaceMotion
; /* Spaceball motion */
407 GLUTspaceRotateFCB fspaceRotate
; /* Spaceball rotate */
408 GLUTspaceButtonFCB fspaceButton
; /* Spaceball button */
409 GLUTtabletMotionFCB ftabletMotion
; /* tablet motion */
410 GLUTtabletButtonFCB ftabletButton
; /* tablet button */
412 GLUTjoystickFCB fjoystick
; /* joystick */
417 struct _GLUToverlay
{
424 XVisualInfo
*vis
; /* visual for window */
425 Bool visAlloced
; /* if vis needs deallocate on destroy */
426 Colormap cmap
; /* RGB colormap for window; None if CI */
427 GLUTcolormap
*colormap
; /* colormap; NULL if RGBA */
428 int shownState
; /* if overlay window mapped */
429 Bool treatAsSingle
; /* treat as single-buffered */
431 Bool isDirect
; /* if direct context */
433 int transparentPixel
; /* transparent pixel value */
434 GLUTdisplayCB display
; /* redraw */
435 #ifdef SUPPORT_FORTRAN
436 GLUTdisplayFCB fdisplay
; /* redraw */
440 typedef struct _GLUTstale GLUTstale
;
447 extern GLUTstale
*__glutStaleWindowList
;
449 #define GLUT_OVERLAY_EVENT_FILTER_MASK \
451 StructureNotifyMask | \
454 #define GLUT_DONT_PROPAGATE_FILTER_MASK \
455 (ButtonReleaseMask | \
459 PointerMotionMask | \
460 Button1MotionMask | \
461 Button2MotionMask | \
463 #define GLUT_HACK_STOP_PROPAGATE_MASK \
467 typedef struct _GLUTmenu GLUTmenu
;
468 typedef struct _GLUTmenuItem GLUTmenuItem
;
470 int id
; /* small integer menu id (0-based) */
471 Window win
; /* X window for the menu */
472 GLUTselectCB select
; /* function of menu */
473 GLUTmenuItem
*list
; /* list of menu entries */
474 int num
; /* number of entries */
476 Bool managed
; /* are the InputOnly windows size
478 Bool searched
; /* help detect menu loops */
479 int pixheight
; /* height of menu in pixels */
480 int pixwidth
; /* width of menu in pixels */
482 int submenus
; /* number of submenu entries */
483 GLUTmenuItem
*highlighted
; /* pointer to highlighted menu
484 entry, NULL not highlighted */
485 GLUTmenu
*cascade
; /* currently cascading this menu */
486 GLUTmenuItem
*anchor
; /* currently anchored to this entry */
487 int x
; /* current x origin relative to the
489 int y
; /* current y origin relative to the
491 #ifdef SUPPORT_FORTRAN
492 GLUTselectFCB fselect
; /* function of menu */
496 struct _GLUTmenuItem
{
497 Window win
; /* InputOnly X window for entry */
498 GLUTmenu
*menu
; /* menu entry belongs to */
499 Bool isTrigger
; /* is a submenu trigger? */
500 int value
; /* value to return for selecting this
501 entry; doubles as submenu id
502 (0-base) if submenu trigger */
504 UINT unique
; /* unique menu item id (Win32 only) */
506 char *label
; /* __glutStrdup'ed label string */
507 int len
; /* length of label string */
508 int pixwidth
; /* width of X window in pixels */
509 GLUTmenuItem
*next
; /* next menu entry on list for menu */
512 typedef struct _GLUTtimer GLUTtimer
;
514 GLUTtimer
*next
; /* list of timers */
516 struct timeval6 timeout
; /* time to be called */
518 struct timeval timeout
; /* time to be called */
520 GLUTtimerCB func
; /* timer (value) */
521 int value
; /* return value */
522 #ifdef SUPPORT_FORTRAN
523 GLUTtimerFCB ffunc
; /* Fortran timer */
527 typedef struct _GLUTeventParser GLUTeventParser
;
528 struct _GLUTeventParser
{
529 int (*func
) (XEvent
*);
530 GLUTeventParser
*next
;
533 /* Declarations to implement glutFullScreen support with
536 /* The following X property format is defined in Motif 1.1's
537 Xm/MwmUtils.h, but GLUT should not depend on that header
538 file. Note: Motif 1.2 expanded this structure with
539 uninteresting fields (to GLUT) so just stick with the
540 smaller Motif 1.1 structure. */
542 #define MWM_HINTS_DECORATIONS 2
549 /* Make current and buffer swap macros. */
551 #define MAKE_CURRENT_LAYER(window) \
553 HGLRC currentContext = wglGetCurrentContext(); \
554 HDC currentDc = wglGetCurrentDC(); \
556 if (currentContext != window->renderCtx \
557 || currentDc != window->renderDc) { \
558 wglMakeCurrent(window->renderDc, window->renderCtx); \
561 #define MAKE_CURRENT_WINDOW(window) \
563 HGLRC currentContext = wglGetCurrentContext(); \
564 HDC currentDc = wglGetCurrentDC(); \
566 if (currentContext != window->ctx || currentDc != window->hdc) { \
567 wglMakeCurrent(window->hdc, window->ctx); \
570 #define MAKE_CURRENT_OVERLAY(overlay) \
571 wglMakeCurrent(overlay->hdc, overlay->ctx)
572 #define UNMAKE_CURRENT() \
573 wglMakeCurrent(NULL, NULL)
574 #define SWAP_BUFFERS_WINDOW(window) \
575 SwapBuffers(window->hdc)
576 #define SWAP_BUFFERS_LAYER(window) \
577 SwapBuffers(window->renderDc)
579 #define MAKE_CURRENT_LAYER(window) \
580 glXMakeCurrent(__glutDisplay, window->renderWin, window->renderCtx)
581 #define MAKE_CURRENT_WINDOW(window) \
582 glXMakeCurrent(__glutDisplay, window->win, window->ctx)
583 #define MAKE_CURRENT_OVERLAY(overlay) \
584 glXMakeCurrent(__glutDisplay, overlay->win, overlay->ctx)
585 #define UNMAKE_CURRENT() \
586 glXMakeCurrent(__glutDisplay, None, NULL)
587 #define SWAP_BUFFERS_WINDOW(window) \
588 glXSwapBuffers(__glutDisplay, window->win)
589 #define SWAP_BUFFERS_LAYER(window) \
590 glXSwapBuffers(__glutDisplay, window->renderWin)
593 /* private variables from glut_event.c */
594 extern GLUTwindow
*__glutWindowWorkList
;
595 extern int __glutWindowDamaged
;
596 #ifdef SUPPORT_FORTRAN
597 extern GLUTtimer
*__glutTimerList
;
598 extern GLUTtimer
*__glutNewTimer
;
600 extern GLUTmenu
*__glutMappedMenu
;
602 extern void (*__glutUpdateInputDeviceMaskFunc
) (GLUTwindow
*);
604 extern void (*__glutMenuItemEnterOrLeave
)(GLUTmenuItem
* item
,
606 extern void (*__glutFinishMenu
)(Window win
, int x
, int y
);
607 extern void (*__glutPaintMenu
)(GLUTmenu
* menu
);
608 extern void (*__glutStartMenu
)(GLUTmenu
* menu
,
609 GLUTwindow
* window
, int x
, int y
, int x_win
, int y_win
);
610 extern GLUTmenu
* (*__glutGetMenuByNum
)(int menunum
);
611 extern GLUTmenuItem
* (*__glutGetMenuItem
)(GLUTmenu
* menu
,
612 Window win
, int *which
);
613 extern GLUTmenu
* (*__glutGetMenu
)(Window win
);
616 /* private variables from glut_init.c */
617 extern Atom __glutWMDeleteWindow
;
618 extern Display
*__glutDisplay
;
619 extern unsigned int __glutDisplayMode
;
620 extern char *__glutDisplayString
;
621 extern XVisualInfo
*(*__glutDetermineVisualFromString
) (char *string
, Bool
* treatAsSingle
,
622 Criterion
* requiredCriteria
, int nRequired
, int requiredMask
, void **fbc
);
623 extern GLboolean __glutDebug
;
624 extern GLboolean __glutForceDirect
;
625 extern GLboolean __glutIconic
;
626 extern GLboolean __glutTryDirect
;
627 extern Window __glutRoot
;
628 extern XSizeHints __glutSizeHints
;
629 extern char **__glutArgv
;
630 extern char *__glutProgramName
;
631 extern int __glutArgc
;
632 extern int __glutConnectionFD
;
633 extern int __glutInitHeight
;
634 extern int __glutInitWidth
;
635 extern int __glutInitX
;
636 extern int __glutInitY
;
637 extern int __glutScreen
;
638 extern int __glutScreenHeight
;
639 extern int __glutScreenWidth
;
640 extern Atom __glutMotifHints
;
641 extern unsigned int __glutModifierMask
;
643 extern void (__cdecl
*__glutExitFunc
)(int retval
);
645 extern char *__glutPPMFile
;
647 /* private variables from glut_menu.c */
648 extern GLUTmenuItem
*__glutItemSelected
;
649 extern GLUTmenu
**__glutMenuList
;
650 extern void (GLUTCALLBACK
*__glutMenuStatusFunc
) (int, int, int);
651 extern void __glutMenuModificationError(void);
652 extern void __glutSetMenuItem(GLUTmenuItem
* item
,
653 const char *label
, int value
, Bool isTrigger
);
655 /* private variables from glut_win.c */
656 extern GLUTwindow
**__glutWindowList
;
657 extern GLUTwindow
*__glutCurrentWindow
;
658 extern GLUTwindow
*__glutMenuWindow
;
659 extern GLUTmenu
*__glutCurrentMenu
;
660 extern int __glutWindowListSize
;
661 extern void (*__glutFreeOverlayFunc
) (GLUToverlay
*);
662 extern void __glutFreeOverlay(GLUToverlay
* overlay
);
663 extern XVisualInfo
*__glutDetermineWindowVisual(Bool
* treatAsSingle
,
664 Bool
* visAlloced
, void **fbc
);
666 /* private variables from glut_ppm.c */
667 extern void __glutWritePPMFile(void);
669 /* private variables from glut_mesa.c */
670 extern int __glutMesaSwapHackSupport
;
672 /* private variables from glut_gamemode.c */
673 extern GLUTwindow
*__glutGameModeWindow
;
675 /* private routines from glut_cindex.c */
676 extern GLUTcolormap
* __glutAssociateNewColormap(XVisualInfo
* vis
);
677 extern void __glutFreeColormap(GLUTcolormap
*);
679 /* private routines from glut_cmap.c */
680 extern void __glutSetupColormap(
682 GLUTcolormap
** colormap
,
685 extern void __glutEstablishColormapsProperty(
686 GLUTwindow
* window
);
687 extern GLUTwindow
*__glutToplevelOf(GLUTwindow
* window
);
690 /* private routines from glut_cursor.c */
691 extern void __glutSetCursor(GLUTwindow
*window
);
693 /* private routines from glut_event.c */
694 extern void __glutPutOnWorkList(GLUTwindow
* window
,
696 extern void __glutRegisterEventParser(GLUTeventParser
* parser
);
697 extern void __glutPostRedisplay(GLUTwindow
* window
, int layerMask
);
698 extern void handleTimeouts(void);
700 /* private routines from glut_init.c */
702 extern void __glutOpenXConnection(char *display
);
704 extern void __glutOpenWin32Connection(char *display
);
707 extern void __glutInitTime(struct timeval6
*beginning
);
709 extern void __glutInitTime(struct timeval
*beginning
);
712 /* private routines for glut_menu.c (or win32_menu.c) */
714 extern GLUTmenu
*__glutGetMenu(Window win
);
715 extern GLUTmenu
*__glutGetMenuByNum(int menunum
);
716 extern GLUTmenuItem
*__glutGetMenuItem(GLUTmenu
* menu
,
717 Window win
, int *which
);
718 extern void __glutStartMenu(GLUTmenu
* menu
,
719 GLUTwindow
* window
, int x
, int y
, int x_win
, int y_win
);
720 extern void __glutFinishMenu(Window win
, int x
, int y
);
722 extern void __glutSetMenu(GLUTmenu
* menu
);
724 /* private routines from glut_util.c */
725 extern char * __glutStrdup(const char *string
);
726 extern void __glutWarning(char *format
,...);
727 extern void __glutFatalError(char *format
,...);
728 extern void __glutFatalUsage(char *format
,...);
730 /* private routines from glut_win.c */
731 extern GLUTwindow
*__glutGetWindow(Window win
);
732 extern void __glutChangeWindowEventMask(long mask
, Bool add
);
733 extern XVisualInfo
*__glutDetermineVisual(
736 XVisualInfo
* (getVisualInfo
) (unsigned int));
737 extern XVisualInfo
*__glutGetVisualInfo(unsigned int mode
);
738 extern void __glutSetWindow(GLUTwindow
* window
);
739 extern void __glutReshapeFunc(GLUTreshapeCB reshapeFunc
,
740 int callingConvention
);
741 extern void GLUTCALLBACK
__glutDefaultReshape(int, int);
742 extern GLUTwindow
*__glutCreateWindow(
744 int x
, int y
, int width
, int height
, int gamemode
);
745 extern void __glutDestroyWindow(
747 GLUTwindow
* initialWindow
);
750 /* private routines from glut_glxext.c */
751 extern int __glutIsSupportedByGLX(char *);
752 extern int __glut_glXBindChannelToWindowSGIX(Display
*dpy
, int screen
,
753 int channel
, Window window
);
754 extern int __glut_glXChannelRectSGIX(Display
*dpy
, int screen
, int channel
,
755 int x
, int y
, int w
, int h
);
756 extern int __glut_glXQueryChannelRectSGIX(Display
*dpy
, int screen
,
757 int channel
, int *x
, int *y
,
759 extern int __glut_glXQueryChannelDeltasSGIX(Display
*dpy
, int screen
,
760 int channel
, int *dx
, int *dy
,
762 extern int __glut_glXChannelRectSyncSGIX(Display
*dpy
, int screen
, int channel
,
764 extern GLXContext
__glut_glXCreateContextWithConfigSGIX(Display
*dpy
,
765 GLXFBConfigSGIX config
,
767 GLXContext share_list
,
769 extern int __glut_glXGetFBConfigAttribSGIX(Display
*dpy
,
770 GLXFBConfigSGIX config
,
773 extern GLXFBConfigSGIX
__glut_glXGetFBConfigFromVisualSGIX(Display
*dpy
,
777 /* private routines from glut_input.c */
778 extern void __glutUpdateInputDeviceMask(GLUTwindow
* window
);
780 /* private routines from glut_mesa.c */
781 extern void __glutDetermineMesaSwapHackSupport(void);
783 /* private routines from glut_gameglut.c */
784 extern void __glutCloseDownGameMode(void);
786 /* private variables from glut_swap.c (BrianP) */
787 extern GLint __glutFPS
;
788 extern GLint __glutSwapCount
;
789 extern GLint __glutSwapTime
;
792 /* private routines from win32_*.c */
793 extern LONG WINAPI
__glutWindowProc(HWND win
, UINT msg
, WPARAM w
, LPARAM l
);
798 #endif /* __glutint_h__ */