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