7116869a8040197f975c25c01d204424dac0471c
[freeglut] / freeglut-1.3 / 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 handled (what about Win32?)
41  *  glutDeviceGet()         -- X11 tests passed, but check if all enums 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 ;
59
60   /*
61    * Return nothing if there is no current window set
62    */
63   if( fgStructure.Window == NULL )
64     return( 0 );
65
66   /*
67    * glXGetConfig should work fine
68    */
69   glXGetConfig( fgDisplay.Display, fgStructure.Window->Window.VisualInfo, attribute, &returnValue );
70
71
72   /*
73    * Have the query results returned
74    */
75   return ( returnValue ) ;
76 }
77 #endif
78
79 /* -- INTERFACE FUNCTIONS -------------------------------------------------- */
80
81 /*
82  * General settings assignment method
83  */
84 void FGAPIENTRY glutSetOption( GLenum eWhat, int value )
85 {
86   freeglut_assert_ready;
87
88   /*
89    * Check what is the caller querying for. In chronological code add order.
90    */
91   switch( eWhat )
92   {
93   case GLUT_INIT_WINDOW_X:          fgState.Position.X          = (GLint)value ;
94                                     break ;
95   case GLUT_INIT_WINDOW_Y:          fgState.Position.Y          = (GLint)value ;
96                                     break ;
97   case GLUT_INIT_WINDOW_WIDTH:      fgState.Size.X              = (GLint)value ;
98                                     break ;
99   case GLUT_INIT_WINDOW_HEIGHT:     fgState.Size.Y              = (GLint)value ;
100                                     break ;
101   case GLUT_INIT_DISPLAY_MODE:      fgState.DisplayMode         = (unsigned int)value ;
102                                     break ;
103
104   case GLUT_ACTION_ON_WINDOW_CLOSE: fgState.ActionOnWindowClose = value ;
105                                     break ;
106
107   case GLUT_WINDOW_CURSOR:
108       if( fgStructure.Window != NULL ) fgStructure.Window->State.Cursor = value ;
109       break ;
110
111   default:
112       /*
113        * Just have it reported, so that we can see what needs to be implemented
114        */
115       fgWarning( "glutSetOption(): missing enum handle %i\n", eWhat );
116       break;
117   }
118 }
119
120 /*
121  * General settings query method
122  */
123 int FGAPIENTRY glutGet( GLenum eWhat )
124 {
125   int returnValue ;
126   GLboolean boolValue ;
127
128   if ( eWhat == GLUT_INIT_STATE )
129     return ( fgState.Time.Set ) ;
130
131     freeglut_assert_ready;
132
133     /*
134      * Check what is the caller querying for. In chronological code add order.
135      */
136     switch( eWhat )
137     {
138     case GLUT_ELAPSED_TIME:
139         /*
140          * This is easy and nicely portable, as we are using GLib...
141          */
142         return( fgElapsedTime() );
143
144     /*
145      * Following values are stored in fgState and fgDisplay global structures
146      */
147     case GLUT_SCREEN_WIDTH:         return( fgDisplay.ScreenWidth    );
148     case GLUT_SCREEN_HEIGHT:        return( fgDisplay.ScreenHeight   );
149     case GLUT_SCREEN_WIDTH_MM:      return( fgDisplay.ScreenWidthMM  );
150     case GLUT_SCREEN_HEIGHT_MM:     return( fgDisplay.ScreenHeightMM );
151     case GLUT_INIT_WINDOW_X:        return( fgState.Position.X       );
152     case GLUT_INIT_WINDOW_Y:        return( fgState.Position.Y       );
153     case GLUT_INIT_WINDOW_WIDTH:    return( fgState.Size.X           );
154     case GLUT_INIT_WINDOW_HEIGHT:   return( fgState.Size.Y           );
155     case GLUT_INIT_DISPLAY_MODE:    return( fgState.DisplayMode      );
156
157     /*
158      * The window/context specific queries are handled mostly by fghGetConfig().
159      */
160     case GLUT_WINDOW_NUM_SAMPLES:
161         /*
162          * Multisampling. Return what I know about multisampling.
163          */
164         return( 0 );
165
166 #if TARGET_HOST_UNIX_X11
167     /*
168      * The rest of GLX queries under X are general enough to use a macro to check them
169      */
170 #   define GLX_QUERY(a,b) case a: return( fghGetConfig( b ) );
171
172     GLX_QUERY( GLUT_WINDOW_RGBA,                GLX_RGBA                );
173     GLX_QUERY( GLUT_WINDOW_DOUBLEBUFFER,        GLX_DOUBLEBUFFER        );
174     GLX_QUERY( GLUT_WINDOW_BUFFER_SIZE,         GLX_BUFFER_SIZE         );
175     GLX_QUERY( GLUT_WINDOW_STENCIL_SIZE,        GLX_STENCIL_SIZE        );
176     GLX_QUERY( GLUT_WINDOW_DEPTH_SIZE,          GLX_DEPTH_SIZE          );
177     GLX_QUERY( GLUT_WINDOW_RED_SIZE,            GLX_RED_SIZE            );
178     GLX_QUERY( GLUT_WINDOW_GREEN_SIZE,          GLX_GREEN_SIZE          );
179     GLX_QUERY( GLUT_WINDOW_BLUE_SIZE,           GLX_BLUE_SIZE           );
180     GLX_QUERY( GLUT_WINDOW_ALPHA_SIZE,          GLX_ALPHA_SIZE          );
181     GLX_QUERY( GLUT_WINDOW_ACCUM_RED_SIZE,      GLX_ACCUM_RED_SIZE      );
182     GLX_QUERY( GLUT_WINDOW_ACCUM_GREEN_SIZE,    GLX_ACCUM_GREEN_SIZE    );
183     GLX_QUERY( GLUT_WINDOW_ACCUM_BLUE_SIZE,     GLX_ACCUM_BLUE_SIZE     );
184     GLX_QUERY( GLUT_WINDOW_ACCUM_ALPHA_SIZE,    GLX_ACCUM_ALPHA_SIZE    );
185     GLX_QUERY( GLUT_WINDOW_STEREO,              GLX_STEREO              );
186
187 #   undef GLX_QUERY
188
189     /*
190      * Colormap size is handled in a bit different way than all the rest
191      */
192     case GLUT_WINDOW_COLORMAP_SIZE:
193         /*
194          * Check for the visual type
195          */
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
205         /*
206          * Otherwise return the number of entries in the colormap
207          */
208         return( fgStructure.Window->Window.VisualInfo->visual->map_entries );
209
210     /*
211      * Those calls are somewhat similiar, as they use XGetWindowAttributes() function
212      */
213     case GLUT_WINDOW_X:
214     case GLUT_WINDOW_Y:
215     case GLUT_WINDOW_WIDTH:
216     case GLUT_WINDOW_HEIGHT:
217     case GLUT_WINDOW_BORDER_WIDTH :
218     case GLUT_WINDOW_HEADER_HEIGHT :
219     {
220         XWindowAttributes winAttributes;
221
222         /*
223          * Return zero if there is no current window set
224          */
225         if( fgStructure.Window == NULL )
226             return( 0 );
227
228         /*
229          * Grab the current window's attributes now
230          */
231         XGetWindowAttributes(
232             fgDisplay.Display,
233             fgStructure.Window->Window.Handle,
234             &winAttributes
235         );
236
237         /*
238          * See which window attribute to return
239          */
240         switch ( eWhat )
241         {
242         case GLUT_WINDOW_X:                return winAttributes.x ;
243         case GLUT_WINDOW_Y:                return winAttributes.y ;
244         case GLUT_WINDOW_WIDTH:            return winAttributes.width ;
245         case GLUT_WINDOW_HEIGHT:           return winAttributes.height ;
246         case GLUT_WINDOW_BORDER_WIDTH :    return winAttributes.border_width ;
247         case GLUT_WINDOW_HEADER_HEIGHT :   return winAttributes.border_width * 3 ;  /* a kludge for now */
248         }
249     }
250
251     /*
252      * I do not know yet if there will be a fgChooseVisual() function for Win32
253      */
254     case GLUT_DISPLAY_MODE_POSSIBLE:
255         /*
256          * Check if the current display mode is possible
257          */
258         return( fgChooseVisual() == NULL ? 0 : 1 );
259
260     /*
261      * This is system-dependant
262      */
263     case GLUT_WINDOW_FORMAT_ID:
264         /*
265          * Return the visual ID, if there is a current window naturally:
266          */
267         if( fgStructure.Window == NULL )
268             return( 0 );
269
270         return( fgStructure.Window->Window.VisualInfo->visualid );
271
272 #elif TARGET_HOST_WIN32
273
274     /*
275      * Handle the OpenGL inquiries
276      */
277     case GLUT_WINDOW_RGBA:
278       glGetBooleanv ( GL_RGBA_MODE, &boolValue ) ;         /* True if color buffers store RGBA */
279       returnValue = boolValue ? 1 : 0 ;
280       return ( returnValue ) ;
281     case GLUT_WINDOW_DOUBLEBUFFER:
282       glGetBooleanv ( GL_DOUBLEBUFFER, &boolValue ) ;      /* True if front and back buffers exist */
283       returnValue = boolValue ? 1 : 0 ;
284       return ( returnValue ) ;
285     case GLUT_WINDOW_STEREO:
286       glGetBooleanv ( GL_STEREO, &boolValue ) ;            /* True if left and right buffers exist */
287       returnValue = boolValue ? 1 : 0 ;
288       return ( returnValue ) ;
289
290     case GLUT_WINDOW_RED_SIZE:
291       glGetIntegerv ( GL_RED_BITS, &returnValue ) ;          /* Number of bits per red component in color buffers */
292       return ( returnValue ) ;
293     case GLUT_WINDOW_GREEN_SIZE:
294       glGetIntegerv ( GL_GREEN_BITS, &returnValue ) ;        /* Number of bits per green component in color buffers */
295       return ( returnValue ) ;
296     case GLUT_WINDOW_BLUE_SIZE:
297       glGetIntegerv ( GL_BLUE_BITS, &returnValue ) ;         /* Number of bits per blue component in color buffers */
298       return ( returnValue ) ;
299     case GLUT_WINDOW_ALPHA_SIZE:
300       glGetIntegerv ( GL_ALPHA_BITS, &returnValue ) ;        /* Number of bits per alpha component in color buffers */
301       return ( returnValue ) ;
302     case GLUT_WINDOW_ACCUM_RED_SIZE:
303       glGetIntegerv ( GL_ACCUM_RED_BITS, &returnValue ) ;    /* Number of bits per red component in the accumulation buffer */
304       return ( returnValue ) ;
305     case GLUT_WINDOW_ACCUM_GREEN_SIZE:
306       glGetIntegerv ( GL_ACCUM_GREEN_BITS, &returnValue ) ;  /* Number of bits per green component in the accumulation buffer */
307       return ( returnValue ) ;
308     case GLUT_WINDOW_ACCUM_BLUE_SIZE:
309       glGetIntegerv ( GL_ACCUM_BLUE_BITS, &returnValue ) ;   /* Number of bits per blue component in the accumulation buffer */
310       return ( returnValue ) ;
311     case GLUT_WINDOW_ACCUM_ALPHA_SIZE:
312       glGetIntegerv ( GL_ACCUM_ALPHA_BITS, &returnValue ) ;  /* Number of bits per alpha component in the accumulation buffer */
313       return ( returnValue ) ;
314     case GLUT_WINDOW_DEPTH_SIZE:
315       glGetIntegerv ( GL_DEPTH_BITS, &returnValue ) ;        /* Number of depth-buffer bitplanes */
316       return ( returnValue ) ;
317
318     case GLUT_WINDOW_BUFFER_SIZE:
319       returnValue = 1 ;                                      /* ????? */
320       return ( returnValue ) ;
321     case GLUT_WINDOW_STENCIL_SIZE:
322       returnValue = 0 ;                                      /* ????? */
323       return ( returnValue ) ;
324
325     /*
326      * Window position and size
327      */
328     case GLUT_WINDOW_X:
329     case GLUT_WINDOW_Y:
330     case GLUT_WINDOW_WIDTH:
331     case GLUT_WINDOW_HEIGHT:
332     {
333         /*
334          *  There is considerable confusion about the "right thing to do" concerning window
335          * size and position.  GLUT itself is not consistent between Windows and Linux; since
336          * platform independence is a virtue for "freeglut", we decided to break with GLUT's
337          * behaviour.
338          *  Under Linux, it is apparently not possible to get the window border sizes in order
339          * to subtract them off the window's initial position until some time after the window
340          * has been created.  Therefore we decided on the following behaviour, both under
341          * Windows and under Linux:
342          *  - When you create a window with position (x,y) and size (w,h), the upper left hand
343          *    corner of the outside of the window is at (x,y) and the size of the drawable area
344          *    is (w,h).
345          *  - When you query the size and position of the window--as is happening here for
346          *    Windows--"freeglut" will return the size of the drawable area--the (w,h) that you
347          *    specified when you created the window--and the coordinates of the upper left hand
348          *    corner of the drawable area--which is NOT the (x,y) you specified.
349          */
350
351         RECT winRect;
352
353         /*
354          * Check if there is a window to be queried for dimensions:
355          */
356         freeglut_return_val_if_fail( fgStructure.Window != NULL, 0 );
357
358         /*
359          * We need to call GetWindowRect() first...
360          *  (this returns the pixel coordinates of the outside of the window)
361          */
362         GetWindowRect( fgStructure.Window->Window.Handle, &winRect );
363
364         /*
365          * ...then we've got to correct the results we've just received...
366          */
367         if ( fgStructure.Window->Parent == NULL )
368         {
369           winRect.left   += GetSystemMetrics( SM_CXSIZEFRAME );
370           winRect.right  -= GetSystemMetrics( SM_CXSIZEFRAME );
371           winRect.top    += GetSystemMetrics( SM_CYSIZEFRAME ) + GetSystemMetrics( SM_CYCAPTION );
372           winRect.bottom -= GetSystemMetrics( SM_CYSIZEFRAME );
373         }
374
375         /*
376          * ...and finally return the caller the desired value:
377          */
378         switch( eWhat )
379         {
380         case GLUT_WINDOW_X:      return( winRect.left                 );
381         case GLUT_WINDOW_Y:      return( winRect.top                  );
382         case GLUT_WINDOW_WIDTH:  return( winRect.right - winRect.left );
383         case GLUT_WINDOW_HEIGHT: return( winRect.bottom - winRect.top );
384         }
385     }
386     break;
387
388     case GLUT_WINDOW_BORDER_WIDTH :
389         return ( GetSystemMetrics( SM_CXSIZEFRAME ) ) ;
390
391     case GLUT_WINDOW_HEADER_HEIGHT :
392         return ( GetSystemMetrics( SM_CYCAPTION ) ) ;
393
394     case GLUT_DISPLAY_MODE_POSSIBLE:
395         /*
396          * Check if the current display mode is possible
397          */
398         return( fgSetupPixelFormat( fgStructure.Window, TRUE, PFD_MAIN_PLANE ) );
399
400     case GLUT_WINDOW_FORMAT_ID:
401         /*
402          * Return the pixel format of the current window
403          */
404         if( fgStructure.Window != NULL )
405             return( GetPixelFormat( fgStructure.Window->Window.Device ) );
406
407         /*
408          * If the current window does not exist, fail:
409          */
410         return( 0 );
411
412 #endif
413
414     /*
415      * The window structure queries
416      */
417     case GLUT_WINDOW_PARENT:
418         /*
419          * Return the ID number of current window's parent, if any
420          */
421         if( fgStructure.Window         == NULL ) return( 0 );
422         if( fgStructure.Window->Parent == NULL ) return( 0 );
423
424         return( fgStructure.Window->Parent->ID );
425
426     case GLUT_WINDOW_NUM_CHILDREN:
427         /*
428          * Return the number of children attached to the current window
429          */
430         if( fgStructure.Window == NULL )
431             return( 0 );
432
433         return( fgListLength( &fgStructure.Window->Children ) );
434
435     case GLUT_WINDOW_CURSOR:
436         /*
437          * Return the currently selected window cursor
438          */
439         if( fgStructure.Window == NULL )
440             return( 0 );
441
442         return( fgStructure.Window->State.Cursor );
443
444     case GLUT_MENU_NUM_ITEMS:
445         /*
446          * Return the number of menu entries in the current menu
447          */
448         if( fgStructure.Menu == NULL )
449             return( 0 );
450
451         return( fgListLength( &fgStructure.Menu->Entries ) );
452
453     case GLUT_ACTION_ON_WINDOW_CLOSE: return ( fgState.ActionOnWindowClose ) ;
454
455     default:
456         /*
457          * Just have it reported, so that we can see what needs to be implemented
458          */
459         fgWarning( "glutGet(): missing enum handle %i\n", eWhat );
460         break;
461     }
462
463     /*
464      * If nothing happens, then we are in deep trouble...
465      */
466     return( -1 );
467 }
468
469 /*
470  * Returns various device information.
471  */
472 int FGAPIENTRY glutDeviceGet( GLenum eWhat )
473 {
474     freeglut_assert_ready;
475
476     /*
477      * See why are we bothered...
478      *
479      * WARNING: we are mostly lying in this function.
480      */
481     switch( eWhat )
482     {
483     case GLUT_HAS_KEYBOARD:
484         /*
485          * We always have a keyboard present on PC machines...
486          */
487         return( TRUE );
488
489 #if TARGET_HOST_UNIX_X11
490
491     case GLUT_HAS_MOUSE:
492         /*
493          * Hey, my Atari 65XE hasn't had a mouse!
494          */
495         return( TRUE );
496
497     case GLUT_NUM_MOUSE_BUTTONS:
498         /*
499          * Return the number of mouse buttons available. This is a big guess.
500          */
501         return( 3 );
502
503 #elif TARGET_HOST_WIN32
504
505     case GLUT_HAS_MOUSE:
506         /*
507          * The Windows can be booted without a mouse. 
508          * It would be nice to have this reported.
509          */
510         return( GetSystemMetrics( SM_MOUSEPRESENT ) );
511
512     case GLUT_NUM_MOUSE_BUTTONS:
513         /*
514          * We are much more fortunate under Win32 about this...
515          */
516         return( GetSystemMetrics( SM_CMOUSEBUTTONS ) );
517
518 #endif
519
520     case GLUT_JOYSTICK_POLL_RATE:
521     case GLUT_HAS_JOYSTICK:
522     case GLUT_JOYSTICK_BUTTONS:
523     case GLUT_JOYSTICK_AXES:
524         /*
525          * WARNING: THIS IS A BIG LIE!
526          */
527         return( 0 );
528
529     case GLUT_HAS_SPACEBALL:
530     case GLUT_HAS_DIAL_AND_BUTTON_BOX:
531     case GLUT_HAS_TABLET:
532         /*
533          * Sounds cool. And unuseful.
534          */
535         return( FALSE );
536
537     case GLUT_NUM_SPACEBALL_BUTTONS:
538     case GLUT_NUM_BUTTON_BOX_BUTTONS:
539     case GLUT_NUM_DIALS:
540     case GLUT_NUM_TABLET_BUTTONS:
541         /*
542          * Zero is not the answer. Zero is the question. Continuum is the answer.
543          */
544         return( 0 );
545
546     case GLUT_DEVICE_IGNORE_KEY_REPEAT:
547         /*
548          * Return what we think about the key auto repeat settings
549          */
550         return( fgState.IgnoreKeyRepeat );
551
552     case GLUT_DEVICE_KEY_REPEAT:
553         /*
554          * WARNING: THIS IS A BIG LIE!
555          */
556         return( GLUT_KEY_REPEAT_DEFAULT );
557
558     default:
559         /*
560          * Complain.
561          */
562         fgWarning( "glutDeviceGet(): missing enum handle %i\n", eWhat );
563         break;
564     }
565
566     /*
567      * And now -- the failure.
568      */
569     return( -1 );
570 }
571
572 /*
573  * This should return the current state of ALT, SHIFT and CTRL keys.
574  */
575 int FGAPIENTRY glutGetModifiers( void )
576 {
577     /*
578      * Fail if there is no current window or called outside an input callback
579      */
580     if( fgStructure.Window == NULL )
581         return( 0 );
582
583     if( fgStructure.Window->State.Modifiers == 0xffffffff )
584     {
585         fgWarning( "glutGetModifiers() called outside an input callback" );
586         return( 0 );
587     }
588
589     /*
590      * Return the current modifiers state otherwise
591      */
592     return( fgStructure.Window->State.Modifiers );
593 }
594
595 /*
596  * Return the state of the GLUT API overlay subsystem. A misery ;-)
597  */
598 int FGAPIENTRY glutLayerGet( GLenum eWhat )
599 {
600     freeglut_assert_ready;
601
602     /*
603      * This is easy as layers are not implemented ;-)
604      */
605     switch( eWhat )
606     {
607
608 #if TARGET_HOST_UNIX_X11
609
610     case GLUT_OVERLAY_POSSIBLE:
611         /*
612          * Nope, overlays are not possible.
613          */
614         return( FALSE );
615
616     case GLUT_LAYER_IN_USE:
617         /*
618          * The normal plane is always in use
619          */
620         return( GLUT_NORMAL );
621
622     case GLUT_HAS_OVERLAY:
623         /*
624          * No window is allowed to have an overlay
625          */
626         return( FALSE );
627
628     case GLUT_TRANSPARENT_INDEX:
629         /*
630          * Return just anything, which is always defined as zero
631          */
632         return( 0 );
633
634     case GLUT_NORMAL_DAMAGED:
635         /*
636          * Actually I do not know. Maybe.
637          */
638         return( FALSE );
639
640     case GLUT_OVERLAY_DAMAGED:
641         /*
642          * Return minus one to mark that no layer is in use
643          */
644         return( -1 );
645
646 #elif TARGET_HOST_WIN32
647
648     case GLUT_OVERLAY_POSSIBLE:
649         /*
650          * Check if an overlay display mode is possible
651          */
652         return( fgSetupPixelFormat( fgStructure.Window, TRUE, PFD_OVERLAY_PLANE ) );
653
654     case GLUT_LAYER_IN_USE:
655         /*
656          * The normal plane is always in use
657          */
658         return( GLUT_NORMAL );
659
660     case GLUT_HAS_OVERLAY:
661         /*
662          * No window is allowed to have an overlay
663          */
664         return( FALSE );
665
666     case GLUT_TRANSPARENT_INDEX:
667         /*
668          * Return just anything, which is always defined as zero
669          */
670         return( 0 );
671
672     case GLUT_NORMAL_DAMAGED:
673         /*
674          * Actually I do not know. Maybe.
675          */
676         return( FALSE );
677
678     case GLUT_OVERLAY_DAMAGED:
679         /*
680          * Return minus one to mark that no layer is in use
681          */
682         return( -1 );
683 #endif
684
685     default:
686         /*
687          * Complain to the user about the obvious bug
688          */
689         fgWarning( "glutLayerGet(): missing enum handle %i\n", eWhat );
690         break;
691     }
692
693     /*
694      * And fail. That's good. Programs do love failing.
695      */
696     return( -1 );
697 }
698
699 /*** END OF FILE ***/