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