Added FREEGLUT_VERSION_1_3.
[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:
454         return fgState.ActionOnWindowClose;
455
456     case GLUT_VERSION:
457         return VERSION_MAJOR * 10000 + VERSION_MINOR * 100 + VERSION_PATCH;
458
459     default:
460         /*
461          * Just have it reported, so that we can see what needs to be implemented
462          */
463         fgWarning( "glutGet(): missing enum handle %i\n", eWhat );
464         break;
465     }
466
467     /*
468      * If nothing happens, then we are in deep trouble...
469      */
470     return( -1 );
471 }
472
473 /*
474  * Returns various device information.
475  */
476 int FGAPIENTRY glutDeviceGet( GLenum eWhat )
477 {
478     freeglut_assert_ready;
479
480     /*
481      * See why are we bothered...
482      *
483      * WARNING: we are mostly lying in this function.
484      */
485     switch( eWhat )
486     {
487     case GLUT_HAS_KEYBOARD:
488         /*
489          * We always have a keyboard present on PC machines...
490          */
491         return( TRUE );
492
493 #if TARGET_HOST_UNIX_X11
494
495     case GLUT_HAS_MOUSE:
496         /*
497          * Hey, my Atari 65XE hasn't had a mouse!
498          */
499         return( TRUE );
500
501     case GLUT_NUM_MOUSE_BUTTONS:
502         /*
503          * Return the number of mouse buttons available. This is a big guess.
504          */
505         return( 3 );
506
507 #elif TARGET_HOST_WIN32
508
509     case GLUT_HAS_MOUSE:
510         /*
511          * The Windows can be booted without a mouse. 
512          * It would be nice to have this reported.
513          */
514         return( GetSystemMetrics( SM_MOUSEPRESENT ) );
515
516     case GLUT_NUM_MOUSE_BUTTONS:
517         /*
518          * We are much more fortunate under Win32 about this...
519          */
520         return( GetSystemMetrics( SM_CMOUSEBUTTONS ) );
521
522 #endif
523
524     case GLUT_JOYSTICK_POLL_RATE:
525     case GLUT_HAS_JOYSTICK:
526     case GLUT_JOYSTICK_BUTTONS:
527     case GLUT_JOYSTICK_AXES:
528         /*
529          * WARNING: THIS IS A BIG LIE!
530          */
531         return( 0 );
532
533     case GLUT_HAS_SPACEBALL:
534     case GLUT_HAS_DIAL_AND_BUTTON_BOX:
535     case GLUT_HAS_TABLET:
536         /*
537          * Sounds cool. And unuseful.
538          */
539         return( FALSE );
540
541     case GLUT_NUM_SPACEBALL_BUTTONS:
542     case GLUT_NUM_BUTTON_BOX_BUTTONS:
543     case GLUT_NUM_DIALS:
544     case GLUT_NUM_TABLET_BUTTONS:
545         /*
546          * Zero is not the answer. Zero is the question. Continuum is the answer.
547          */
548         return( 0 );
549
550     case GLUT_DEVICE_IGNORE_KEY_REPEAT:
551         /*
552          * Return what we think about the key auto repeat settings
553          */
554         return( fgState.IgnoreKeyRepeat );
555
556     case GLUT_DEVICE_KEY_REPEAT:
557         /*
558          * WARNING: THIS IS A BIG LIE!
559          */
560         return( GLUT_KEY_REPEAT_DEFAULT );
561
562     default:
563         /*
564          * Complain.
565          */
566         fgWarning( "glutDeviceGet(): missing enum handle %i\n", eWhat );
567         break;
568     }
569
570     /*
571      * And now -- the failure.
572      */
573     return( -1 );
574 }
575
576 /*
577  * This should return the current state of ALT, SHIFT and CTRL keys.
578  */
579 int FGAPIENTRY glutGetModifiers( void )
580 {
581     /*
582      * Fail if there is no current window or called outside an input callback
583      */
584     if( fgStructure.Window == NULL )
585         return( 0 );
586
587     if( fgStructure.Window->State.Modifiers == 0xffffffff )
588     {
589         fgWarning( "glutGetModifiers() called outside an input callback" );
590         return( 0 );
591     }
592
593     /*
594      * Return the current modifiers state otherwise
595      */
596     return( fgStructure.Window->State.Modifiers );
597 }
598
599 /*
600  * Return the state of the GLUT API overlay subsystem. A misery ;-)
601  */
602 int FGAPIENTRY glutLayerGet( GLenum eWhat )
603 {
604     freeglut_assert_ready;
605
606     /*
607      * This is easy as layers are not implemented ;-)
608      */
609     switch( eWhat )
610     {
611
612 #if TARGET_HOST_UNIX_X11
613
614     case GLUT_OVERLAY_POSSIBLE:
615         /*
616          * Nope, overlays are not possible.
617          */
618         return( FALSE );
619
620     case GLUT_LAYER_IN_USE:
621         /*
622          * The normal plane is always in use
623          */
624         return( GLUT_NORMAL );
625
626     case GLUT_HAS_OVERLAY:
627         /*
628          * No window is allowed to have an overlay
629          */
630         return( FALSE );
631
632     case GLUT_TRANSPARENT_INDEX:
633         /*
634          * Return just anything, which is always defined as zero
635          */
636         return( 0 );
637
638     case GLUT_NORMAL_DAMAGED:
639         /*
640          * Actually I do not know. Maybe.
641          */
642         return( FALSE );
643
644     case GLUT_OVERLAY_DAMAGED:
645         /*
646          * Return minus one to mark that no layer is in use
647          */
648         return( -1 );
649
650 #elif TARGET_HOST_WIN32
651
652     case GLUT_OVERLAY_POSSIBLE:
653         /*
654          * Check if an overlay display mode is possible
655          */
656         return( fgSetupPixelFormat( fgStructure.Window, TRUE, PFD_OVERLAY_PLANE ) );
657
658     case GLUT_LAYER_IN_USE:
659         /*
660          * The normal plane is always in use
661          */
662         return( GLUT_NORMAL );
663
664     case GLUT_HAS_OVERLAY:
665         /*
666          * No window is allowed to have an overlay
667          */
668         return( FALSE );
669
670     case GLUT_TRANSPARENT_INDEX:
671         /*
672          * Return just anything, which is always defined as zero
673          */
674         return( 0 );
675
676     case GLUT_NORMAL_DAMAGED:
677         /*
678          * Actually I do not know. Maybe.
679          */
680         return( FALSE );
681
682     case GLUT_OVERLAY_DAMAGED:
683         /*
684          * Return minus one to mark that no layer is in use
685          */
686         return( -1 );
687 #endif
688
689     default:
690         /*
691          * Complain to the user about the obvious bug
692          */
693         fgWarning( "glutLayerGet(): missing enum handle %i\n", eWhat );
694         break;
695     }
696
697     /*
698      * And fail. That's good. Programs do love failing.
699      */
700     return( -1 );
701 }
702
703 /*** END OF FILE ***/