Lots of stuff that John F. Fay pointed out.
[freeglut] / src / freeglut_state.c
1 /*
2  * freeglut_state.c
3  *
4  * Freeglut state query methods.
5  *
6  * Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
7  * Written by Pawel W. Olszta, <olszta@sourceforge.net>
8  * Creation date: Thu Dec 16 1999
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining a
11  * copy of this software and associated documentation files (the "Software"),
12  * to deal in the Software without restriction, including without limitation
13  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  * and/or sell copies of the Software, and to permit persons to whom the
15  * Software is furnished to do so, subject to the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be included
18  * in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
23  * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
24  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26  */
27
28 #ifdef HAVE_CONFIG_H
29 #include "config.h"
30 #endif
31
32 #include "../include/GL/freeglut.h"
33 #include "freeglut_internal.h"
34
35 /*
36  * TODO BEFORE THE STABLE RELEASE:
37  *
38  *  glutGet()               -- X11 tests passed, but check if all enums
39  *                             handled (what about Win32?)
40  *  glutDeviceGet()         -- X11 tests passed, but check if all enums
41  *                             handled (what about Win32?)
42  *  glutGetModifiers()      -- OK, but could also remove the limitation
43  *  glutLayerGet()          -- what about GLUT_NORMAL_DAMAGED?
44  *
45  * The fail-on-call policy will help adding the most needed things imho.
46  */
47
48 /* -- LOCAL DEFINITIONS ---------------------------------------------------- */
49
50 /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
51
52 #if TARGET_HOST_UNIX_X11
53 /*
54  * Queries the GL context about some attributes
55  */
56 static int fghGetConfig( int attribute )
57 {
58   int returnValue = 0;
59
60   if( fgStructure.Window )
61       glXGetConfig( fgDisplay.Display, fgStructure.Window->Window.VisualInfo,
62                     attribute, &returnValue );
63
64   return returnValue;
65 }
66 #endif
67
68 /* -- INTERFACE FUNCTIONS -------------------------------------------------- */
69
70 /*
71  * General settings assignment method
72  */
73 void FGAPIENTRY glutSetOption( GLenum eWhat, int value )
74 {
75   freeglut_assert_ready;
76
77   /*
78    * XXX In chronological code add order.  (WHY in that order?)
79    */
80   switch( eWhat )
81   {
82   case GLUT_INIT_WINDOW_X:
83       fgState.Position.X = (GLint)value;
84       break;
85
86   case GLUT_INIT_WINDOW_Y:
87       fgState.Position.Y = (GLint)value;
88       break;
89
90   case GLUT_INIT_WINDOW_WIDTH:
91       fgState.Size.X = (GLint)value;
92       break;
93
94   case GLUT_INIT_WINDOW_HEIGHT:
95       fgState.Size.Y = (GLint)value;
96       break;
97
98   case GLUT_INIT_DISPLAY_MODE:
99       fgState.DisplayMode = (unsigned int)value;
100       break;
101
102   case GLUT_ACTION_ON_WINDOW_CLOSE:
103       fgState.ActionOnWindowClose = value;
104       break;
105
106   case GLUT_RENDERING_CONTEXT:
107       fgState.UseCurrentContext =
108           ( value == GLUT_USE_CURRENT_CONTEXT ) ? GL_TRUE : GL_FALSE;
109       break;
110
111   case GLUT_WINDOW_CURSOR:
112       if( fgStructure.Window != NULL )
113           fgStructure.Window->State.Cursor = value;
114       break;
115
116   default:
117       fgWarning( "glutSetOption(): missing enum handle %i\n", eWhat );
118       break;
119   }
120 }
121
122 /*
123  * General settings query method
124  */
125 int FGAPIENTRY glutGet( GLenum eWhat )
126 {
127 #if TARGET_HOST_WIN32
128     int returnValue ;
129     GLboolean boolValue ;
130 #endif
131
132     switch (eWhat)
133     {
134     case GLUT_INIT_STATE:
135         return ( fgState.Initialised ) ;
136
137     case GLUT_ELAPSED_TIME:
138         return( fgElapsedTime() );
139     }
140
141     freeglut_assert_ready;
142
143     /*
144      * XXX In chronological code add order.  (WHY in that order?)
145      */
146     switch( eWhat )
147     {
148     /*
149      * Following values are stored in fgState and fgDisplay global structures
150      */
151     case GLUT_SCREEN_WIDTH:         return( fgDisplay.ScreenWidth    );
152     case GLUT_SCREEN_HEIGHT:        return( fgDisplay.ScreenHeight   );
153     case GLUT_SCREEN_WIDTH_MM:      return( fgDisplay.ScreenWidthMM  );
154     case GLUT_SCREEN_HEIGHT_MM:     return( fgDisplay.ScreenHeightMM );
155     case GLUT_INIT_WINDOW_X:        return( fgState.Position.X       );
156     case GLUT_INIT_WINDOW_Y:        return( fgState.Position.Y       );
157     case GLUT_INIT_WINDOW_WIDTH:    return( fgState.Size.X           );
158     case GLUT_INIT_WINDOW_HEIGHT:   return( fgState.Size.Y           );
159     case GLUT_INIT_DISPLAY_MODE:    return( fgState.DisplayMode      );
160
161     /*
162      * The window/context specific queries are handled mostly by
163      * fghGetConfig().
164      */
165     case GLUT_WINDOW_NUM_SAMPLES:
166         /*
167          * XXX Multisampling. Return what I know about multisampling.
168          */
169         return( 0 );
170
171 #if TARGET_HOST_UNIX_X11
172     /*
173      * The rest of GLX queries under X are general enough to use a macro to
174      * check them
175      */
176 #   define GLX_QUERY(a,b) case a: return( fghGetConfig( b ) );
177
178     GLX_QUERY( GLUT_WINDOW_RGBA,                GLX_RGBA                );
179     GLX_QUERY( GLUT_WINDOW_DOUBLEBUFFER,        GLX_DOUBLEBUFFER        );
180     GLX_QUERY( GLUT_WINDOW_BUFFER_SIZE,         GLX_BUFFER_SIZE         );
181     GLX_QUERY( GLUT_WINDOW_STENCIL_SIZE,        GLX_STENCIL_SIZE        );
182     GLX_QUERY( GLUT_WINDOW_DEPTH_SIZE,          GLX_DEPTH_SIZE          );
183     GLX_QUERY( GLUT_WINDOW_RED_SIZE,            GLX_RED_SIZE            );
184     GLX_QUERY( GLUT_WINDOW_GREEN_SIZE,          GLX_GREEN_SIZE          );
185     GLX_QUERY( GLUT_WINDOW_BLUE_SIZE,           GLX_BLUE_SIZE           );
186     GLX_QUERY( GLUT_WINDOW_ALPHA_SIZE,          GLX_ALPHA_SIZE          );
187     GLX_QUERY( GLUT_WINDOW_ACCUM_RED_SIZE,      GLX_ACCUM_RED_SIZE      );
188     GLX_QUERY( GLUT_WINDOW_ACCUM_GREEN_SIZE,    GLX_ACCUM_GREEN_SIZE    );
189     GLX_QUERY( GLUT_WINDOW_ACCUM_BLUE_SIZE,     GLX_ACCUM_BLUE_SIZE     );
190     GLX_QUERY( GLUT_WINDOW_ACCUM_ALPHA_SIZE,    GLX_ACCUM_ALPHA_SIZE    );
191     GLX_QUERY( GLUT_WINDOW_STEREO,              GLX_STEREO              );
192
193 #   undef GLX_QUERY
194
195     /*
196      * Colormap size is handled in a bit different way than all the rest
197      */
198     case GLUT_WINDOW_COLORMAP_SIZE:
199         if( (fghGetConfig( GLX_RGBA )) || (fgStructure.Window == NULL) )
200         {
201             /*
202              * We've got a RGBA visual, so there is no colormap at all.
203              * The other possibility is that we have no current window set.
204              */
205             return( 0 );
206         }
207         return( fgStructure.Window->Window.VisualInfo->visual->map_entries );
208
209     /*
210      * Those calls are somewhat similiar, as they use XGetWindowAttributes()
211      * function
212      */
213     case GLUT_WINDOW_X:
214     case GLUT_WINDOW_Y:
215     case GLUT_WINDOW_BORDER_WIDTH:
216     case GLUT_WINDOW_HEADER_HEIGHT:
217     {
218         int x, y;
219         Window w;
220
221         if( fgStructure.Window == NULL )
222             return( 0 );
223
224         XTranslateCoordinates(
225             fgDisplay.Display,
226             fgStructure.Window->Window.Handle,
227             fgDisplay.RootWindow,
228             0, 0, &x, &y, &w);
229
230         switch ( eWhat )
231         {
232         case GLUT_WINDOW_X: return x;
233         case GLUT_WINDOW_Y: return y;
234         }
235
236         if ( w == 0 )
237             return( 0 );
238         XTranslateCoordinates(
239             fgDisplay.Display,
240             fgStructure.Window->Window.Handle,
241             w, 0, 0, &x, &y, &w);
242
243         switch ( eWhat )
244         {
245         case GLUT_WINDOW_BORDER_WIDTH:  return x;
246         case GLUT_WINDOW_HEADER_HEIGHT: return y;
247         }
248     }
249
250     case GLUT_WINDOW_WIDTH:
251     case GLUT_WINDOW_HEIGHT:
252     {
253         XWindowAttributes winAttributes;
254
255         if( fgStructure.Window == NULL )
256             return( 0 );
257         XGetWindowAttributes(
258             fgDisplay.Display,
259             fgStructure.Window->Window.Handle,
260             &winAttributes
261         );
262         switch ( eWhat )
263         {
264         case GLUT_WINDOW_WIDTH:            return winAttributes.width ;
265         case GLUT_WINDOW_HEIGHT:           return winAttributes.height ;
266         }
267     }
268
269     /*
270      * I do not know yet if there will be a fgChooseVisual() function for Win32
271      */
272     case GLUT_DISPLAY_MODE_POSSIBLE:
273         return( fgChooseVisual() == NULL ? 0 : 1 );
274
275     /*
276      * This is system-dependant
277      */
278     case GLUT_WINDOW_FORMAT_ID:
279         if( fgStructure.Window == NULL )
280             return( 0 );
281
282         return( fgStructure.Window->Window.VisualInfo->visualid );
283
284 #elif TARGET_HOST_WIN32
285
286     /*
287      * Handle the OpenGL inquiries
288      */
289     case GLUT_WINDOW_RGBA:
290       glGetBooleanv ( GL_RGBA_MODE, &boolValue ) ;
291       returnValue = boolValue ? 1 : 0 ;
292       return ( returnValue ) ;
293     case GLUT_WINDOW_DOUBLEBUFFER:
294       glGetBooleanv ( GL_DOUBLEBUFFER, &boolValue ) ;
295       returnValue = boolValue ? 1 : 0 ;
296       return ( returnValue ) ;
297     case GLUT_WINDOW_STEREO:
298       glGetBooleanv ( GL_STEREO, &boolValue ) ;
299       returnValue = boolValue ? 1 : 0 ;
300       return ( returnValue ) ;
301
302     case GLUT_WINDOW_RED_SIZE:
303       glGetIntegerv ( GL_RED_BITS, &returnValue ) ;
304       return ( returnValue ) ;
305     case GLUT_WINDOW_GREEN_SIZE:
306       glGetIntegerv ( GL_GREEN_BITS, &returnValue ) ;
307       return ( returnValue ) ;
308     case GLUT_WINDOW_BLUE_SIZE:
309       glGetIntegerv ( GL_BLUE_BITS, &returnValue ) ;
310       return ( returnValue ) ;
311     case GLUT_WINDOW_ALPHA_SIZE:
312       glGetIntegerv ( GL_ALPHA_BITS, &returnValue ) ;
313       return ( returnValue ) ;
314     case GLUT_WINDOW_ACCUM_RED_SIZE:
315       glGetIntegerv ( GL_ACCUM_RED_BITS, &returnValue ) ;
316       return ( returnValue ) ;
317     case GLUT_WINDOW_ACCUM_GREEN_SIZE:
318       glGetIntegerv ( GL_ACCUM_GREEN_BITS, &returnValue ) ;
319       return ( returnValue ) ;
320     case GLUT_WINDOW_ACCUM_BLUE_SIZE:
321       glGetIntegerv ( GL_ACCUM_BLUE_BITS, &returnValue ) ;
322       return ( returnValue ) ;
323     case GLUT_WINDOW_ACCUM_ALPHA_SIZE:
324       glGetIntegerv ( GL_ACCUM_ALPHA_BITS, &returnValue ) ;
325       return ( returnValue ) ;
326     case GLUT_WINDOW_DEPTH_SIZE:
327       glGetIntegerv ( GL_DEPTH_BITS, &returnValue ) ;
328       return ( returnValue ) ;
329
330     case GLUT_WINDOW_BUFFER_SIZE:
331       returnValue = 1 ;                                      /* ????? */
332       return ( returnValue ) ;
333     case GLUT_WINDOW_STENCIL_SIZE:
334       returnValue = 0 ;                                      /* ????? */
335       return ( returnValue ) ;
336
337     case GLUT_WINDOW_X:
338     case GLUT_WINDOW_Y:
339     case GLUT_WINDOW_WIDTH:
340     case GLUT_WINDOW_HEIGHT:
341     {
342         /*
343          *  There is considerable confusion about the "right thing to
344          *  do" concerning window  size and position.  GLUT itself is
345          *  not consistent between Windows and UNIX/X11; since
346          *  platform independence is a virtue for "freeglut", we
347          *  decided to break with GLUT's behaviour.
348          *
349          *  Under UNIX/X11, it is apparently not possible to get the
350          *  window border sizes in order to subtract them off the
351          *  window's initial position until some time after the window
352          *  has been created.  Therefore we decided on the following
353          *  behaviour, both under Windows and under UNIX/X11:
354          *  - When you create a window with position (x,y) and size
355          *    (w,h), the upper left hand corner of the outside of the
356          *    window is at (x,y) and the size of the drawable area  is
357          *    (w,h).
358          *  - When you query the size and position of the window--as
359          *    is happening here for Windows--"freeglut" will return
360          *    the size of the drawable area--the (w,h) that you
361          *    specified when you created the window--and the coordinates
362          *    of the upper left hand corner of the drawable
363          *    area--which is NOT the (x,y) you specified.
364          */
365
366         RECT winRect;
367
368         freeglut_return_val_if_fail( fgStructure.Window != NULL, 0 );
369
370         /*
371          * We need to call GetWindowRect() first...
372          *  (this returns the pixel coordinates of the outside of the window)
373          */
374         GetWindowRect( fgStructure.Window->Window.Handle, &winRect );
375
376         /*
377          * ...then we've got to correct the results we've just received...
378          */
379         if ( ( fgStructure.GameMode != fgStructure.Window ) && ( fgStructure.Window->Parent == NULL ) &&
380              ( ! fgStructure.Window->IsMenu ) )
381         {
382           winRect.left   += GetSystemMetrics( SM_CXSIZEFRAME );
383           winRect.right  -= GetSystemMetrics( SM_CXSIZEFRAME );
384           winRect.top    += GetSystemMetrics( SM_CYSIZEFRAME ) + GetSystemMetrics( SM_CYCAPTION );
385           winRect.bottom -= GetSystemMetrics( SM_CYSIZEFRAME );
386         }
387
388         switch( eWhat )
389         {
390         case GLUT_WINDOW_X:      return( winRect.left                 );
391         case GLUT_WINDOW_Y:      return( winRect.top                  );
392         case GLUT_WINDOW_WIDTH:  return( winRect.right - winRect.left );
393         case GLUT_WINDOW_HEIGHT: return( winRect.bottom - winRect.top );
394         }
395     }
396     break;
397
398     case GLUT_WINDOW_BORDER_WIDTH :
399         return ( GetSystemMetrics( SM_CXSIZEFRAME ) ) ;
400
401     case GLUT_WINDOW_HEADER_HEIGHT :
402         return ( GetSystemMetrics( SM_CYCAPTION ) ) ;
403
404     case GLUT_DISPLAY_MODE_POSSIBLE:
405         return( fgSetupPixelFormat( fgStructure.Window, GL_TRUE,
406                                     PFD_MAIN_PLANE ) );
407
408     case GLUT_WINDOW_FORMAT_ID:
409         if( fgStructure.Window != NULL )
410             return( GetPixelFormat( fgStructure.Window->Window.Device ) );
411         return( 0 );
412
413 #endif
414
415     /*
416      * The window structure queries
417      */
418     case GLUT_WINDOW_PARENT:
419         if( fgStructure.Window         == NULL ) return( 0 );
420         if( fgStructure.Window->Parent == NULL ) return( 0 );
421         return( fgStructure.Window->Parent->ID );
422
423     case GLUT_WINDOW_NUM_CHILDREN:
424         if( fgStructure.Window == NULL )
425             return( 0 );
426         return( fgListLength( &fgStructure.Window->Children ) );
427
428     case GLUT_WINDOW_CURSOR:
429         if( fgStructure.Window == NULL )
430             return( 0 );
431         return( fgStructure.Window->State.Cursor );
432
433     case GLUT_MENU_NUM_ITEMS:
434         if( fgStructure.Menu == NULL )
435             return( 0 );
436         return( fgListLength( &fgStructure.Menu->Entries ) );
437
438     case GLUT_ACTION_ON_WINDOW_CLOSE:
439         return fgState.ActionOnWindowClose ;
440
441     case GLUT_VERSION :
442         return VERSION_MAJOR * 10000 + VERSION_MINOR * 100 + VERSION_PATCH ;
443
444     case GLUT_RENDERING_CONTEXT:
445         return ( fgState.UseCurrentContext ? GLUT_USE_CURRENT_CONTEXT : GLUT_CREATE_NEW_CONTEXT ) ;
446
447     default:
448         fgWarning( "glutGet(): missing enum handle %i\n", eWhat );
449         break;
450     }
451     return( -1 );
452 }
453
454 /*
455  * Returns various device information.
456  */
457 int FGAPIENTRY glutDeviceGet( GLenum eWhat )
458 {
459     freeglut_assert_ready;
460
461     /*
462      * XXX WARNING: we are mostly lying in this function.
463      */
464     switch( eWhat )
465     {
466     case GLUT_HAS_KEYBOARD:
467         /*
468          * We always have a keyboard present on PC machines...
469          *
470          * XXX I think that some of my PCs will boot without a keyboard.
471          * XXX Also, who says that we are running on a PC?  UNIX/X11
472          * XXX is much more generic, and X11 can go over a network.
473          * XXX Though in actuality, we can probably assume BOTH a
474          * XXX mouse and keyboard for most/all of our users.
475          */
476         return( TRUE );
477
478 #if TARGET_HOST_UNIX_X11
479
480     case GLUT_HAS_MOUSE:
481         return( TRUE );
482
483     case GLUT_NUM_MOUSE_BUTTONS:
484         /*
485          * Return the number of mouse buttons available. This is a big guess.
486          *
487          * XXX We can probe /var/run/dmesg.boot which is world-readable.
488          * XXX This would be somewhat system-dependant, but is doable.
489          * XXX E.g., on NetBSD, my USB mouse registers:
490          * XXX   ums0 at uhidev0: 3 buttons and Z dir.
491          * XXX We can also probe /var/log/XFree86\..*\.log to get
492          * XXX lines such as:
493          * XXX   (**) Option "Buttons" "5"
494          * XXX   (**) Option "ZAxisMapping" "4 5"
495          * XXX   (**) Mouse0: ZAxisMapping: buttons 4 and 5
496          * XXX   (**) Mouse0: Buttons: 5
497          * XXX ...which tells us even more, and is a bit less
498          * XXX system-dependant.  (Other than MS-WINDOWS, all
499          * XXX target hosts with actual users are probably running
500          * XXX XFree86...)  It is at least worth taking a look at
501          * XXX this file.
502          */
503         return( 3 );
504
505 #elif TARGET_HOST_WIN32
506
507     case GLUT_HAS_MOUSE:
508         /*
509          * The Windows can be booted without a mouse. 
510          * It would be nice to have this reported.
511          */
512         return( GetSystemMetrics( SM_MOUSEPRESENT ) );
513
514     case GLUT_NUM_MOUSE_BUTTONS:
515         /*
516          * We are much more fortunate under Win32 about this...
517          */
518         return( GetSystemMetrics( SM_CMOUSEBUTTONS ) );
519
520 #endif
521
522     case GLUT_JOYSTICK_POLL_RATE:
523     case GLUT_HAS_JOYSTICK:
524     case GLUT_JOYSTICK_BUTTONS:
525     case GLUT_JOYSTICK_AXES:
526         /*
527          * XXX WARNING: THIS IS A BIG LIE!
528          */
529         return( 0 );
530
531     case GLUT_HAS_SPACEBALL:
532     case GLUT_HAS_DIAL_AND_BUTTON_BOX:
533     case GLUT_HAS_TABLET:
534         return( FALSE );
535
536     case GLUT_NUM_SPACEBALL_BUTTONS:
537     case GLUT_NUM_BUTTON_BOX_BUTTONS:
538     case GLUT_NUM_DIALS:
539     case GLUT_NUM_TABLET_BUTTONS:
540         return( 0 );
541
542     case GLUT_DEVICE_IGNORE_KEY_REPEAT:
543         return( fgState.IgnoreKeyRepeat );
544
545     case GLUT_DEVICE_KEY_REPEAT:
546         /*
547          * XXX WARNING: THIS IS A BIG LIE!
548          */
549         return( GLUT_KEY_REPEAT_DEFAULT );
550
551     default:
552         fgWarning( "glutDeviceGet(): missing enum handle %i\n", eWhat );
553         break;
554     }
555
556     /*
557      * And now -- the failure.
558      */
559     return( -1 );
560 }
561
562 /*
563  * This should return the current state of ALT, SHIFT and CTRL keys.
564  */
565 int FGAPIENTRY glutGetModifiers( void )
566 {
567     if( fgState.Modifiers == 0xffffffff )
568     {
569         fgWarning( "glutGetModifiers() called outside an input callback" );
570         return( 0 );
571     }
572
573     return( fgState.Modifiers );
574 }
575
576 /*
577  * Return the state of the GLUT API overlay subsystem. A misery ;-)
578  */
579 int FGAPIENTRY glutLayerGet( GLenum eWhat )
580 {
581     freeglut_assert_ready;
582
583     /*
584      * This is easy as layers are not implemented ;-)
585      *
586      * XXX Can we merge the UNIX/X11 and WIN32 sections?  Or
587      * XXX is overlay support planned?
588      */
589     switch( eWhat )
590     {
591
592 #if TARGET_HOST_UNIX_X11
593
594     case GLUT_OVERLAY_POSSIBLE:
595         return( FALSE );
596
597     case GLUT_LAYER_IN_USE:
598         return( GLUT_NORMAL );
599
600     case GLUT_HAS_OVERLAY:
601         return( FALSE );
602
603     case GLUT_TRANSPARENT_INDEX:
604         /*
605          * Return just anything, which is always defined as zero
606          *
607          * XXX HUH?
608          */
609         return( 0 );
610
611     case GLUT_NORMAL_DAMAGED:
612         /*
613          * XXX Actually I do not know. Maybe.
614          */
615         return( FALSE );
616
617     case GLUT_OVERLAY_DAMAGED:
618         return( -1 );
619
620 #elif TARGET_HOST_WIN32
621
622     case GLUT_OVERLAY_POSSIBLE:
623 /*      return( fgSetupPixelFormat( fgStructure.Window, GL_TRUE,
624                                     PFD_OVERLAY_PLANE ) ); */
625       return FALSE ;
626
627     case GLUT_LAYER_IN_USE:
628         return( GLUT_NORMAL );
629
630     case GLUT_HAS_OVERLAY:
631         return( FALSE );
632
633     case GLUT_TRANSPARENT_INDEX:
634         /*
635          * Return just anything, which is always defined as zero
636          *
637          * XXX HUH?
638          */
639         return( 0 );
640
641     case GLUT_NORMAL_DAMAGED:
642         /*
643          * XXX Actually I do not know. Maybe.
644          */
645         return( FALSE );
646
647     case GLUT_OVERLAY_DAMAGED:
648         return( -1 );
649 #endif
650
651     default:
652         fgWarning( "glutLayerGet(): missing enum handle %i\n", eWhat );
653         break;
654     }
655
656     /*
657      * And fail. That's good. Programs do love failing.
658      */
659     return( -1 );
660 }
661
662 /*** END OF FILE ***/