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