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