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