Moved '#include "config.h"' to freeglut_internal.h, we will need it
[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 #include <GL/freeglut.h>
29 #include "freeglut_internal.h"
30
31 /*
32  * TODO BEFORE THE STABLE RELEASE:
33  *
34  *  glutGet()               -- X11 tests passed, but check if all enums
35  *                             handled (what about Win32?)
36  *  glutDeviceGet()         -- X11 tests passed, but check if all enums
37  *                             handled (what about Win32?)
38  *  glutGetModifiers()      -- OK, but could also remove the limitation
39  *  glutLayerGet()          -- what about GLUT_NORMAL_DAMAGED?
40  *
41  * The fail-on-call policy will help adding the most needed things imho.
42  */
43
44 /* -- LOCAL DEFINITIONS ---------------------------------------------------- */
45
46 /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
47
48 #if TARGET_HOST_UNIX_X11
49 /*
50  * Queries the GL context about some attributes
51  */
52 static int fghGetConfig( int attribute )
53 {
54   int returnValue = 0;
55
56   if( fgStructure.Window )
57       glXGetConfig( fgDisplay.Display, fgStructure.Window->Window.VisualInfo,
58                     attribute, &returnValue );
59
60   return returnValue;
61 }
62 #endif
63
64 /* -- INTERFACE FUNCTIONS -------------------------------------------------- */
65
66 /*
67  * General settings assignment method
68  */
69 void FGAPIENTRY glutSetOption( GLenum eWhat, int value )
70 {
71     FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSetOption" );
72
73     /*
74      * XXX In chronological code add order.  (WHY in that order?)
75      */
76     switch( eWhat )
77     {
78     case GLUT_INIT_WINDOW_X:
79         fgState.Position.X = (GLint)value;
80         break;
81
82     case GLUT_INIT_WINDOW_Y:
83         fgState.Position.Y = (GLint)value;
84         break;
85
86     case GLUT_INIT_WINDOW_WIDTH:
87         fgState.Size.X = (GLint)value;
88         break;
89
90     case GLUT_INIT_WINDOW_HEIGHT:
91         fgState.Size.Y = (GLint)value;
92         break;
93
94     case GLUT_INIT_DISPLAY_MODE:
95         fgState.DisplayMode = (unsigned int)value;
96         break;
97
98     case GLUT_ACTION_ON_WINDOW_CLOSE:
99         fgState.ActionOnWindowClose = value;
100         break;
101
102     case GLUT_RENDERING_CONTEXT:
103         fgState.UseCurrentContext =
104             ( value == GLUT_USE_CURRENT_CONTEXT ) ? GL_TRUE : GL_FALSE;
105         break;
106
107     case GLUT_DIRECT_RENDERING:
108         fgState.DirectContext = value;
109         break;
110
111     case GLUT_WINDOW_CURSOR:
112         if( fgStructure.Window != NULL )
113             fgStructure.Window->State.Cursor = value;
114         break;
115
116     default:
117         fgWarning( "glutSetOption(): missing enum handle %d", eWhat );
118         break;
119     }
120 }
121
122 /*
123  * General settings query method
124  */
125 int FGAPIENTRY glutGet( GLenum eWhat )
126 {
127 #if TARGET_HOST_WIN32 || TARGET_HOST_WINCE
128     int returnValue ;
129     GLboolean boolValue ;
130 #endif
131
132     switch (eWhat)
133     {
134     case GLUT_INIT_STATE:
135         return fgState.Initialised;
136
137     case GLUT_ELAPSED_TIME:
138         return fgElapsedTime();
139     }
140
141     FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGet" );
142
143     /* XXX In chronological code add order.  (WHY in that order?) */
144     switch( eWhat )
145     {
146     /* Following values are stored in fgState and fgDisplay global structures */
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
159      * fghGetConfig().
160      */
161     case GLUT_WINDOW_NUM_SAMPLES:
162         /* XXX Multisampling. Return what I know about multisampling. */
163         return 0;
164
165 #if TARGET_HOST_UNIX_X11
166     /*
167      * The rest of GLX queries under X are general enough to use a macro to
168      * 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     /* Colormap size is handled in a bit different way than all the rest */
190     case GLUT_WINDOW_COLORMAP_SIZE:
191         if( (fghGetConfig( GLX_RGBA )) || (fgStructure.Window == NULL) )
192         {
193             /*
194              * We've got a RGBA visual, so there is no colormap at all.
195              * The other possibility is that we have no current window set.
196              */
197             return 0;
198         }
199         return fgStructure.Window->Window.VisualInfo->visual->map_entries;
200
201     /*
202      * Those calls are somewhat similiar, as they use XGetWindowAttributes()
203      * function
204      */
205     case GLUT_WINDOW_X:
206     case GLUT_WINDOW_Y:
207     case GLUT_WINDOW_BORDER_WIDTH:
208     case GLUT_WINDOW_HEADER_HEIGHT:
209     {
210         int x, y;
211         Window w;
212
213         if( fgStructure.Window == NULL )
214             return 0;
215
216         XTranslateCoordinates(
217             fgDisplay.Display,
218             fgStructure.Window->Window.Handle,
219             fgDisplay.RootWindow,
220             0, 0, &x, &y, &w);
221
222         switch ( eWhat )
223         {
224         case GLUT_WINDOW_X: return x;
225         case GLUT_WINDOW_Y: return y;
226         }
227
228         if ( w == 0 )
229             return 0;
230         XTranslateCoordinates(
231             fgDisplay.Display,
232             fgStructure.Window->Window.Handle,
233             w, 0, 0, &x, &y, &w);
234
235         switch ( eWhat )
236         {
237         case GLUT_WINDOW_BORDER_WIDTH:  return x;
238         case GLUT_WINDOW_HEADER_HEIGHT: return y;
239         }
240     }
241
242     case GLUT_WINDOW_WIDTH:
243     case GLUT_WINDOW_HEIGHT:
244     {
245         XWindowAttributes winAttributes;
246
247         if( fgStructure.Window == NULL )
248             return 0;
249         XGetWindowAttributes(
250             fgDisplay.Display,
251             fgStructure.Window->Window.Handle,
252             &winAttributes
253         );
254         switch ( eWhat )
255         {
256         case GLUT_WINDOW_WIDTH:            return winAttributes.width ;
257         case GLUT_WINDOW_HEIGHT:           return winAttributes.height ;
258         }
259     }
260
261     /* I do not know yet if there will be a fgChooseVisual() function for Win32 */
262     case GLUT_DISPLAY_MODE_POSSIBLE:
263         return( fgChooseVisual() == NULL ? 0 : 1 );
264
265     /* This is system-dependant */
266     case GLUT_WINDOW_FORMAT_ID:
267         if( fgStructure.Window == NULL )
268             return 0;
269
270         return fgStructure.Window->Window.VisualInfo->visualid;
271
272 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
273
274     /* Handle the OpenGL inquiries */
275     case GLUT_WINDOW_RGBA:
276       glGetBooleanv ( GL_RGBA_MODE, &boolValue );
277       returnValue = boolValue ? 1 : 0;
278       return returnValue;
279     case GLUT_WINDOW_DOUBLEBUFFER:
280       glGetBooleanv ( GL_DOUBLEBUFFER, &boolValue );
281       returnValue = boolValue ? 1 : 0;
282       return returnValue;
283     case GLUT_WINDOW_STEREO:
284       glGetBooleanv ( GL_STEREO, &boolValue );
285       returnValue = boolValue ? 1 : 0;
286       return returnValue;
287
288     case GLUT_WINDOW_RED_SIZE:
289       glGetIntegerv ( GL_RED_BITS, &returnValue );
290       return returnValue;
291     case GLUT_WINDOW_GREEN_SIZE:
292       glGetIntegerv ( GL_GREEN_BITS, &returnValue );
293       return returnValue;
294     case GLUT_WINDOW_BLUE_SIZE:
295       glGetIntegerv ( GL_BLUE_BITS, &returnValue );
296       return returnValue;
297     case GLUT_WINDOW_ALPHA_SIZE:
298       glGetIntegerv ( GL_ALPHA_BITS, &returnValue );
299       return returnValue;
300     case GLUT_WINDOW_ACCUM_RED_SIZE:
301       glGetIntegerv ( GL_ACCUM_RED_BITS, &returnValue );
302       return returnValue;
303     case GLUT_WINDOW_ACCUM_GREEN_SIZE:
304       glGetIntegerv ( GL_ACCUM_GREEN_BITS, &returnValue );
305       return returnValue;
306     case GLUT_WINDOW_ACCUM_BLUE_SIZE:
307       glGetIntegerv ( GL_ACCUM_BLUE_BITS, &returnValue );
308       return returnValue;
309     case GLUT_WINDOW_ACCUM_ALPHA_SIZE:
310       glGetIntegerv ( GL_ACCUM_ALPHA_BITS, &returnValue );
311       return returnValue;
312     case GLUT_WINDOW_DEPTH_SIZE:
313       glGetIntegerv ( GL_DEPTH_BITS, &returnValue );
314       return returnValue;
315
316     case GLUT_WINDOW_BUFFER_SIZE:
317       returnValue = 1 ;                                      /* ????? */
318       return returnValue;
319     case GLUT_WINDOW_STENCIL_SIZE:
320       returnValue = 0 ;                                      /* ????? */
321       return returnValue;
322
323     case GLUT_WINDOW_X:
324     case GLUT_WINDOW_Y:
325     case GLUT_WINDOW_WIDTH:
326     case GLUT_WINDOW_HEIGHT:
327     {
328         /*
329          *  There is considerable confusion about the "right thing to
330          *  do" concerning window  size and position.  GLUT itself is
331          *  not consistent between Windows and UNIX/X11; since
332          *  platform independence is a virtue for "freeglut", we
333          *  decided to break with GLUT's behaviour.
334          *
335          *  Under UNIX/X11, it is apparently not possible to get the
336          *  window border sizes in order to subtract them off the
337          *  window's initial position until some time after the window
338          *  has been created.  Therefore we decided on the following
339          *  behaviour, both under Windows and under UNIX/X11:
340          *  - When you create a window with position (x,y) and size
341          *    (w,h), the upper left hand corner of the outside of the
342          *    window is at (x,y) and the size of the drawable area  is
343          *    (w,h).
344          *  - When you query the size and position of the window--as
345          *    is happening here for Windows--"freeglut" will return
346          *    the size of the drawable area--the (w,h) that you
347          *    specified when you created the window--and the coordinates
348          *    of the upper left hand corner of the drawable
349          *    area--which is NOT the (x,y) you specified.
350          */
351
352         RECT winRect;
353
354         freeglut_return_val_if_fail( fgStructure.Window != NULL, 0 );
355
356         /*
357          * We need to call GetWindowRect() first...
358          *  (this returns the pixel coordinates of the outside of the window)
359          */
360         GetWindowRect( fgStructure.Window->Window.Handle, &winRect );
361
362         /* ...then we've got to correct the results we've just received... */
363
364 #if !TARGET_HOST_WINCE
365         if ( ( fgStructure.GameMode != fgStructure.Window ) && ( fgStructure.Window->Parent == NULL ) &&
366              ( ! fgStructure.Window->IsMenu ) )
367         {
368           winRect.left   += GetSystemMetrics( SM_CXSIZEFRAME );
369           winRect.right  -= GetSystemMetrics( SM_CXSIZEFRAME );
370           winRect.top    += GetSystemMetrics( SM_CYSIZEFRAME ) + GetSystemMetrics( SM_CYCAPTION );
371           winRect.bottom -= GetSystemMetrics( SM_CYSIZEFRAME );
372         }
373 #endif /* !TARGET_HOST_WINCE */
374
375         switch( eWhat )
376         {
377         case GLUT_WINDOW_X:      return winRect.left                ;
378         case GLUT_WINDOW_Y:      return winRect.top                 ;
379         case GLUT_WINDOW_WIDTH:  return winRect.right - winRect.left;
380         case GLUT_WINDOW_HEIGHT: return winRect.bottom - winRect.top;
381         }
382     }
383     break;
384
385     case GLUT_WINDOW_BORDER_WIDTH :
386 #if TARGET_HOST_WINCE
387         return 0;
388 #else
389         return GetSystemMetrics( SM_CXSIZEFRAME );
390 #endif /* !TARGET_HOST_WINCE */
391
392     case GLUT_WINDOW_HEADER_HEIGHT :
393 #if TARGET_HOST_WINCE
394         return 0;
395 #else
396         return GetSystemMetrics( SM_CYCAPTION );
397 #endif /* TARGET_HOST_WINCE */
398
399     case GLUT_DISPLAY_MODE_POSSIBLE:
400 #if TARGET_HOST_WINCE
401         return GL_FALSE;
402 #else
403         return fgSetupPixelFormat( fgStructure.Window, GL_TRUE,
404                                     PFD_MAIN_PLANE );
405 #endif /* TARGET_HOST_WINCE */
406
407
408     case GLUT_WINDOW_FORMAT_ID:
409 #if !TARGET_HOST_WINCE
410         if( fgStructure.Window != NULL )
411             return GetPixelFormat( fgStructure.Window->Window.Device );
412 #endif /* TARGET_HOST_WINCE */
413         return 0;
414
415 #endif
416
417     /* The window structure queries */
418     case GLUT_WINDOW_PARENT:
419         if( fgStructure.Window         == NULL ) return 0;
420         if( fgStructure.Window->Parent == NULL ) return 0;
421         return fgStructure.Window->Parent->ID;
422
423     case GLUT_WINDOW_NUM_CHILDREN:
424         if( fgStructure.Window == NULL )
425             return 0;
426         return fgListLength( &fgStructure.Window->Children );
427
428     case GLUT_WINDOW_CURSOR:
429         if( fgStructure.Window == NULL )
430             return 0;
431         return fgStructure.Window->State.Cursor;
432
433     case GLUT_MENU_NUM_ITEMS:
434         if( fgStructure.Menu == NULL )
435             return 0;
436         return fgListLength( &fgStructure.Menu->Entries );
437
438     case GLUT_ACTION_ON_WINDOW_CLOSE:
439         return fgState.ActionOnWindowClose;
440
441     case GLUT_VERSION :
442         return VERSION_MAJOR * 10000 + VERSION_MINOR * 100 + VERSION_PATCH;
443
444     case GLUT_RENDERING_CONTEXT:
445         return fgState.UseCurrentContext ? GLUT_USE_CURRENT_CONTEXT
446                                          : GLUT_CREATE_NEW_CONTEXT;
447
448     case GLUT_DIRECT_RENDERING:
449         return fgState.DirectContext;
450         break;
451
452     default:
453         fgWarning( "glutGet(): missing enum handle %d", eWhat );
454         break;
455     }
456     return -1;
457 }
458
459 /*
460  * Returns various device information.
461  */
462 int FGAPIENTRY glutDeviceGet( GLenum eWhat )
463 {
464     FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutDeviceGet" );
465
466     /* XXX WARNING: we are mostly lying in this function. */
467     switch( eWhat )
468     {
469     case GLUT_HAS_KEYBOARD:
470         /*
471          * We always have a keyboard present on PC machines...
472          *
473          * XXX I think that some of my PCs will boot without a keyboard.
474          * XXX Also, who says that we are running on a PC?  UNIX/X11
475          * XXX is much more generic, and X11 can go over a network.
476          * XXX Though in actuality, we can probably assume BOTH a
477          * XXX mouse and keyboard for most/all of our users.
478          */
479         return TRUE ;
480
481 #if TARGET_HOST_UNIX_X11
482
483     case GLUT_HAS_MOUSE:
484         return TRUE ;
485
486     case GLUT_NUM_MOUSE_BUTTONS:
487         /*
488          * Return the number of mouse buttons available. This is a big guess.
489          *
490          * XXX We can probe /var/run/dmesg.boot which is world-readable.
491          * XXX This would be somewhat system-dependant, but is doable.
492          * XXX E.g., on NetBSD, my USB mouse registers:
493          * XXX   ums0 at uhidev0: 3 buttons and Z dir.
494          * XXX We can also probe /var/log/XFree86\..*\.log to get
495          * XXX lines such as:
496          * XXX   (**) Option "Buttons" "5"
497          * XXX   (**) Option "ZAxisMapping" "4 5"
498          * XXX   (**) Mouse0: ZAxisMapping: buttons 4 and 5
499          * XXX   (**) Mouse0: Buttons: 5
500          * XXX ...which tells us even more, and is a bit less
501          * XXX system-dependant.  (Other than MS-WINDOWS, all
502          * XXX target hosts with actual users are probably running
503          * XXX XFree86...)  It is at least worth taking a look at
504          * XXX this file.
505          */
506         return 3 ;
507
508 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
509
510     case GLUT_HAS_MOUSE:
511         /*
512          * The Windows can be booted without a mouse.
513          * It would be nice to have this reported.
514          */
515         return GetSystemMetrics( SM_MOUSEPRESENT );
516
517     case GLUT_NUM_MOUSE_BUTTONS:
518         /* We are much more fortunate under Win32 about this... */
519 #if TARGET_HOST_WINCE
520         return 1;
521 #else
522         return GetSystemMetrics( SM_CMOUSEBUTTONS );
523 #endif /* TARGET_HOST_WINCE */
524
525 #endif
526
527     case GLUT_HAS_JOYSTICK:
528         return fgJoystickDetect ();
529
530     case GLUT_OWNS_JOYSTICK:
531         return fgState.JoysticksInitialised;
532
533     case GLUT_JOYSTICK_POLL_RATE:
534         return fgStructure.Window ? fgStructure.Window->State.JoystickPollRate : 0;
535
536     /* XXX The following two are only for Joystick 0 but this is an improvement */
537     case GLUT_JOYSTICK_BUTTONS:
538         return glutJoystickGetNumButtons ( 0 );
539
540     case GLUT_JOYSTICK_AXES:
541         return glutJoystickGetNumAxes ( 0 );
542
543     case GLUT_HAS_SPACEBALL:
544     case GLUT_HAS_DIAL_AND_BUTTON_BOX:
545     case GLUT_HAS_TABLET:
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         return 0;
553
554     case GLUT_DEVICE_IGNORE_KEY_REPEAT:
555         return fgStructure.Window ? fgStructure.Window->State.IgnoreKeyRepeat : 0;
556
557     case GLUT_DEVICE_KEY_REPEAT:
558         /* XXX WARNING: THIS IS A BIG LIE! */
559         return GLUT_KEY_REPEAT_DEFAULT;
560
561     default:
562         fgWarning( "glutDeviceGet(): missing enum handle %d", eWhat );
563         break;
564     }
565
566     /* And now -- the failure. */
567     return -1;
568 }
569
570 /*
571  * This should return the current state of ALT, SHIFT and CTRL keys.
572  */
573 int FGAPIENTRY glutGetModifiers( void )
574 {
575     FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGetModifiers" );
576     if( fgState.Modifiers == 0xffffffff )
577     {
578         fgWarning( "glutGetModifiers() called outside an input callback" );
579         return 0;
580     }
581
582     return fgState.Modifiers;
583 }
584
585 /*
586  * Return the state of the GLUT API overlay subsystem. A misery ;-)
587  */
588 int FGAPIENTRY glutLayerGet( GLenum eWhat )
589 {
590     FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutLayerGet" );
591
592     /*
593      * This is easy as layers are not implemented ;-)
594      *
595      * XXX Can we merge the UNIX/X11 and WIN32 sections?  Or
596      * XXX is overlay support planned?
597      */
598     switch( eWhat )
599     {
600
601 #if TARGET_HOST_UNIX_X11
602
603     case GLUT_OVERLAY_POSSIBLE:
604         return FALSE;
605
606     case GLUT_LAYER_IN_USE:
607         return GLUT_NORMAL;
608
609     case GLUT_HAS_OVERLAY:
610         return FALSE;
611
612     case GLUT_TRANSPARENT_INDEX:
613         /*
614          * Return just anything, which is always defined as zero
615          *
616          * XXX HUH?
617          */
618         return 0;
619
620     case GLUT_NORMAL_DAMAGED:
621         /* XXX Actually I do not know. Maybe. */
622         return FALSE;
623
624     case GLUT_OVERLAY_DAMAGED:
625         return -1;
626
627 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
628
629     case GLUT_OVERLAY_POSSIBLE:
630 /*      return fgSetupPixelFormat( fgStructure.Window, GL_TRUE,
631                                    PFD_OVERLAY_PLANE ); */
632       return FALSE ;
633
634     case GLUT_LAYER_IN_USE:
635         return GLUT_NORMAL;
636
637     case GLUT_HAS_OVERLAY:
638         return FALSE;
639
640     case GLUT_TRANSPARENT_INDEX:
641         /*
642          * Return just anything, which is always defined as zero
643          *
644          * XXX HUH?
645          */
646         return 0;
647
648     case GLUT_NORMAL_DAMAGED:
649         /* XXX Actually I do not know. Maybe. */
650         return FALSE;
651
652     case GLUT_OVERLAY_DAMAGED:
653         return -1;
654 #endif
655
656     default:
657         fgWarning( "glutLayerGet(): missing enum handle %d", eWhat );
658         break;
659     }
660
661     /* And fail. That's good. Programs do love failing. */
662     return -1;
663 }
664
665 /*** END OF FILE ***/