4 * Window management methods.
6 * Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
7 * Written by Pawel W. Olszta, <olszta@sourceforge.net>
8 * Creation date: Fri Dec 3 1999
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:
17 * The above copyright notice and this permission notice shall be included
18 * in all copies or substantial portions of the Software.
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.
32 #define G_LOG_DOMAIN "freeglut-window"
34 #include "../include/GL/freeglut.h"
35 #include "freeglut_internal.h"
38 * TODO BEFORE THE STABLE RELEASE:
40 * fgChooseVisual() -- OK, but what about glutInitDisplayString()?
41 * fgSetupPixelFormat -- ignores the display mode settings
42 * fgOpenWindow() -- check the Win32 version, -iconic handling!
43 * fgCloseWindow() -- check the Win32 version
44 * glutCreateWindow() -- see what happens when default position and size is {-1,-1}
45 * glutCreateSubWindow() -- see what happens when default position and size is {-1,-1}
46 * glutDestroyWindow() -- check the Win32 version
47 * glutSetWindow() -- check the Win32 version
48 * glutGetWindow() -- OK
49 * glutSetWindowTitle() -- check the Win32 version
50 * glutSetIconTitle() -- check the Win32 version
51 * glutShowWindow() -- check the Win32 version
52 * glutHideWindow() -- check the Win32 version
53 * glutIconifyWindow() -- check the Win32 version
54 * glutReshapeWindow() -- check the Win32 version
55 * glutPositionWindow() -- check the Win32 version
56 * glutPushWindow() -- check the Win32 version
57 * glutPopWindow() -- check the Win32 version
60 /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
63 * Chooses a visual basing on the current display mode settings
65 #if TARGET_HOST_UNIX_X11
66 XVisualInfo* fgChooseVisual( void )
68 int bufferSize[] = { 16, 12, 8, 4, 2, 1 };
69 GLboolean wantIndexedMode = FALSE;
74 * First we have to process the display mode settings...
76 # define ATTRIB(a) attributes[where++]=a;
79 * Decide if we want a true or indexed color visual:
81 if( !(fgState.DisplayMode & GLUT_INDEX) )
84 * We are sure that there will be R, B and B components requested:
87 ATTRIB( GLX_RED_SIZE ); ATTRIB( 1 );
88 ATTRIB( GLX_GREEN_SIZE ); ATTRIB( 1 );
89 ATTRIB( GLX_BLUE_SIZE ); ATTRIB( 1 );
92 * Check if the A component is required, too:
94 if( fgState.DisplayMode & GLUT_ALPHA )
96 ATTRIB( GLX_ALPHA_SIZE ); ATTRIB( 1 );
102 * We've got an indexed color request
104 ATTRIB( GLX_BUFFER_SIZE ); ATTRIB( 8 );
107 * Set the 'I want indexed mode' switch
109 wantIndexedMode = TRUE;
113 * We can have double or single buffered contexts created
115 if( fgState.DisplayMode & GLUT_DOUBLE )
117 ATTRIB( GLX_DOUBLEBUFFER );
121 * Stereoscopy seems a nice thing to have
123 if( fgState.DisplayMode & GLUT_STEREO )
125 ATTRIB( GLX_STEREO );
129 * Depth buffer is almost always required
131 if( fgState.DisplayMode & GLUT_DEPTH )
133 ATTRIB( GLX_DEPTH_SIZE ); ATTRIB( 1 );
139 if( fgState.DisplayMode & GLUT_STENCIL )
141 ATTRIB( GLX_STENCIL_SIZE ); ATTRIB( 1 );
145 * And finally the accumulation buffers
147 if( fgState.DisplayMode & GLUT_ACCUM )
149 ATTRIB( GLX_ACCUM_RED_SIZE ); ATTRIB( 1 );
150 ATTRIB( GLX_ACCUM_GREEN_SIZE ); ATTRIB( 1 );
151 ATTRIB( GLX_ACCUM_BLUE_SIZE ); ATTRIB( 1 );
154 * Check if the A component is required, too:
156 if( fgState.DisplayMode & GLUT_ALPHA )
158 ATTRIB( GLX_ACCUM_ALPHA_SIZE ); ATTRIB( 1 );
163 * Push a null at the end of the list
168 * OKi now, we've got two cases -- RGB(A) and index mode visuals
170 if( wantIndexedMode == FALSE )
173 * The easier one. And more common, too.
175 return( glXChooseVisual( fgDisplay.Display, fgDisplay.Screen, attributes ) );
179 XVisualInfo* visualInfo;
183 * In indexed mode, we need to check how many bits of depth can we achieve
189 * The GLX_BUFFER_SIZE value comes always first, so:
191 attributes[ 1 ] = bufferSize[ i ];
194 * Check if such visual is possible
196 visualInfo = glXChooseVisual( fgDisplay.Display, fgDisplay.Screen, attributes );
199 * The buffer size are sorted in descendant order, so choose the first:
201 if( visualInfo != NULL )
202 return( visualInfo );
206 * If we are still here, it means that the visual info was not found
214 * Setup the pixel format for a Win32 window
216 #if TARGET_HOST_WIN32
217 GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly, unsigned char layer_type )
219 PIXELFORMATDESCRIPTOR* ppfd, pfd;
220 int flags, pixelformat;
223 * Check if the window seems valid
225 freeglut_return_val_if_fail( window != NULL, 0 );
228 * The pixel format should allow us to draw to the window using OpenGL
230 flags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
233 * It might be the case for us to use double buffering
235 if( fgState.DisplayMode & GLUT_DOUBLE )
236 flags |= PFD_DOUBLEBUFFER;
239 * Specify which pixel format do we opt for...
241 # pragma message( "fgSetupPixelFormat(): there is still some work to do here!" )
243 pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
246 pfd.iPixelType = PFD_TYPE_RGBA;
257 pfd.cAccumRedBits = 0;
258 pfd.cAccumGreenBits = 0;
259 pfd.cAccumBlueBits = 0;
260 pfd.cAccumAlphaBits = 0;
263 pfd.cStencilBits = 0;
266 pfd.cStencilBits = 8;
269 pfd.iLayerType = layer_type;
272 pfd.dwVisibleMask = 0;
273 pfd.dwDamageMask = 0;
276 * Fill in the color bits...
278 pfd.cColorBits = (BYTE) GetDeviceCaps( window->Window.Device, BITSPIXEL );
282 * Choose the pixel format that matches our demand
284 pixelformat = ChoosePixelFormat( window->Window.Device, ppfd );
285 if( pixelformat == 0 )
289 * We might have been called to check if the pixel format exists only
295 * Finally, set the window's pixel format
297 return ( SetPixelFormat( window->Window.Device, pixelformat, ppfd ) ) ;
302 * Sets the OpenGL context and the fgStructure "Current Window" pointer to the window
303 * structure passed in.
305 void fgSetWindow ( SFG_Window *window )
307 #if TARGET_HOST_UNIX_X11
309 * Make the selected window's GLX context the current one
313 window->Window.Handle,
314 window->Window.Context
317 #elif TARGET_HOST_WIN32
319 * Release the previous' context's device context
321 if( fgStructure.Window != NULL )
322 ReleaseDC( fgStructure.Window->Window.Handle, fgStructure.Window->Window.Device );
327 * We will care about releasing the device context later
329 window->Window.Device = GetDC( window->Window.Handle );
332 * Set the new current context:
335 window->Window.Device,
336 window->Window.Context
342 * Remember that we have changed the current window state
344 fgStructure.Window = window;
349 * Opens a window. Requires a SFG_Window object created and attached
350 * to the freeglut structure. OpenGL context is created here.
352 void fgOpenWindow( SFG_Window* window, const char* title, int x, int y, int w, int h, GLboolean gameMode, int isSubWindow )
354 #if TARGET_HOST_UNIX_X11
355 XSetWindowAttributes winAttr;
356 XTextProperty textProperty;
357 XSizeHints sizeHints;
361 freeglut_assert_ready;
364 * Here we are upon the stage. Have the visual selected.
366 window->Window.VisualInfo = fgChooseVisual();
367 if ( ! window->Window.VisualInfo )
370 * The "fgChooseVisual" returned a null meaning that the visual context is not available.
371 * Try a couple of variations to see if they will work.
373 if ( ! ( fgState.DisplayMode & GLUT_DOUBLE ) )
376 * Single buffering--try it doubled
378 fgState.DisplayMode |= GLUT_DOUBLE ;
379 window->Window.VisualInfo = fgChooseVisual();
383 * GLUT also checks for multi-sampling, but I don't see that anywhere else in FREEGLUT
384 * so I won't bother with it for the moment.
388 assert( window->Window.VisualInfo != NULL );
391 * Have the windows attributes set
393 * HINT: the masks should be updated when adding/removing callbacks.
394 * This might speed up message processing. Is that true?
396 winAttr.event_mask = StructureNotifyMask | SubstructureNotifyMask | ExposureMask |
397 ButtonPressMask | ButtonReleaseMask | KeyPressMask | KeyRelease |
398 VisibilityChangeMask | EnterWindowMask | LeaveWindowMask |
399 PointerMotionMask | ButtonMotionMask;
400 winAttr.background_pixmap = None;
401 winAttr.background_pixel = 0;
402 winAttr.border_pixel = 0;
405 * The color map is required, too
407 winAttr.colormap = XCreateColormap(
408 fgDisplay.Display, fgDisplay.RootWindow,
409 window->Window.VisualInfo->visual, AllocNone
413 * This tells the XCreateWindow() what attributes are we supplying it with
415 mask = CWBackPixmap | CWBorderPixel | CWColormap | CWEventMask;
418 * Have the window created now
420 window->Window.Handle = XCreateWindow(
422 window->Parent == NULL ? fgDisplay.RootWindow : window->Parent->Window.Handle,
424 window->Window.VisualInfo->depth, InputOutput,
425 window->Window.VisualInfo->visual, mask,
430 * The GLX context creation, possibly trying the direct context rendering
432 window->Window.Context = glXCreateContext(
433 fgDisplay.Display, window->Window.VisualInfo,
434 NULL, fgState.ForceDirectContext | fgState.TryDirectContext
438 * Make sure the context is direct when the user wants it forced
440 if( fgState.ForceDirectContext && !glXIsDirect( fgDisplay.Display, window->Window.Context ) )
441 fgError( "unable to force direct context rendering for window '%s'", title );
444 * Set the new context as the current one. That's all about the window creation.
448 window->Window.Handle,
449 window->Window.Context
453 * Assume the new window is visible by default
455 window->State.Visible = TRUE;
458 * For the position and size hints -- make sure we are passing valid values
462 if (fgState.Position.Use == TRUE) sizeHints.flags |= USPosition;
463 if (fgState.Size.Use == TRUE) sizeHints.flags |= USSize;
466 * Fill in the size hints values now (the x, y, width and height
467 * settings are obsolote, are there any more WMs that support them?)
469 sizeHints.x = x; sizeHints.y = y;
470 sizeHints.width = w; sizeHints.height = h;
473 * We can have forced all new windows start in iconified state:
475 wmHints.flags = StateHint;
476 wmHints.initial_state = (fgState.ForceIconic == FALSE) ? NormalState : IconicState;
479 * Prepare the window and iconified window names...
481 XStringListToTextProperty( (char **) &title, 1, &textProperty );
484 * Set the window's properties now
488 window->Window.Handle,
499 * Make sure we are informed about the window deletion commands
501 XSetWMProtocols( fgDisplay.Display, window->Window.Handle, &fgDisplay.DeleteWindow, 1 );
504 * Finally, have the window mapped to our display
506 XMapWindow( fgDisplay.Display, window->Window.Handle );
509 * In game mode, move the viewport a bit to hide the decorations.
510 * This code depends on the XFree86 video mode extensions.
512 if( gameMode == TRUE )
515 * This somehow fixes the glutGet() GLUT_WINDOW_X and GLUT_WINDOW_Y problem...
517 XMoveWindow( fgDisplay.Display, window->Window.Handle, x, y );
519 # ifdef X_XF86VidModeSetViewPort
522 * Set the newly created window as the current one...
524 fgSetWindow( window );
527 * Move the viewport a bit down and right from top-left corner to hide the decorations
529 XF86VidModeSetViewPort(
532 glutGet( GLUT_WINDOW_X ),
533 glutGet( GLUT_WINDOW_Y )
539 #elif TARGET_HOST_WIN32
545 freeglut_assert_ready;
548 * Grab the window class we have registered on glutInit():
550 atom = GetClassInfo( fgDisplay.Instance, "FREEGLUT", &wc );
553 if( gameMode == FALSE )
558 * Update the window dimensions, taking account of window decorations.
559 * "freeglut" is to create the window with the outside of its border at (x,y)
560 * and with dimensions (w,h).
562 w += (GetSystemMetrics( SM_CXSIZEFRAME ) )*2;
563 h += (GetSystemMetrics( SM_CYSIZEFRAME ) )*2 + GetSystemMetrics( SM_CYCAPTION );
567 * Check if the user wants us to use the default position/size
569 if( fgState.Position.Use == FALSE ) { x = CW_USEDEFAULT; y = CW_USEDEFAULT; }
570 if( fgState.Size .Use == FALSE ) { w = CW_USEDEFAULT; h = CW_USEDEFAULT; }
573 * There's a small difference between creating the top, child and game mode windows
575 flags = WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE;
577 if( window->Parent == NULL )
578 flags |= WS_OVERLAPPEDWINDOW;
585 * In game mode, the story is a little bit different...
587 assert( window->Parent == NULL );
590 * Set the window creation flags appropriately to make the window entirely visible:
592 flags = WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE;
596 * Create the window now, passing the freeglut window structure as the parameter
598 window->Window.Handle = CreateWindow(
603 (HWND) window->Parent == NULL ? NULL : window->Parent->Window.Handle,
610 * Make sure window was created
612 assert( window->Window.Handle != NULL );
615 * Show and update the main window. Hide the mouse cursor.
617 ShowWindow( window->Window.Handle, fgState.ForceIconic ? SW_SHOWMINIMIZED : SW_SHOW );
618 UpdateWindow( window->Window.Handle );
624 * Save the window's single- or double-buffering state
626 window->Window.DoubleBuffered = ( fgState.DisplayMode & GLUT_DOUBLE ) ? 1 : 0 ;
629 * If it's not double-buffered, make sure the rendering is done to the front buffer.
631 if ( ! window->Window.DoubleBuffered )
633 glDrawBuffer ( GL_FRONT ) ;
634 glReadBuffer ( GL_FRONT ) ;
638 * Set the newly created window as the current one
640 fgSetWindow( window );
644 * Closes a window, destroying the frame and OpenGL context
646 void fgCloseWindow( SFG_Window* window )
648 freeglut_assert_ready;
650 #if TARGET_HOST_UNIX_X11
652 * As easy as kill bunnies with axes. Destroy the context first:
654 glXDestroyContext( fgDisplay.Display, window->Window.Context );
657 * Then have the window killed:
659 XDestroyWindow( fgDisplay.Display, window->Window.Handle );
662 * Finally, flush the rests down the stream
664 XFlush( fgDisplay.Display );
666 #elif TARGET_HOST_WIN32
668 * Send the WM_CLOSE message to the window now
671 window->Window.Handle,
681 /* -- INTERFACE FUNCTIONS -------------------------------------------------- */
684 * Creates a new top-level freeglut window
686 int FGAPIENTRY glutCreateWindow( const char* title )
689 * Create a new window and return its unique ID number
691 return( fgCreateWindow( NULL, title, fgState.Position.X, fgState.Position.Y,
692 fgState.Size.X, fgState.Size.Y, FALSE )->ID );
696 * This function creates a sub window.
698 int FGAPIENTRY glutCreateSubWindow( int parentID, int x, int y, int w, int h )
700 SFG_Window* window = NULL;
701 SFG_Window* parent = NULL;
703 freeglut_assert_ready;
706 * Find a parent to the newly created window...
708 parent = fgWindowByID( parentID );
711 * Fail if the parent has not been found
713 freeglut_return_val_if_fail( parent != NULL, 0 );
716 * Create the new window
718 window = fgCreateWindow( parent, "", x, y, w, h, FALSE );
721 * Return the new window's ID
723 return( window->ID );
727 * Destroys a window and all of its subwindows
729 void FGAPIENTRY glutDestroyWindow( int windowID )
731 fgExecutionState ExecState = fgState.ExecState ;
734 * Grab the freeglut window pointer from the structure
736 SFG_Window* window = fgWindowByID( windowID );
737 freeglut_return_if_fail( window != NULL );
740 * There is a function that performs all needed steps
741 * defined in freeglut_structure.c. Let's use it:
743 fgAddToWindowDestroyList( window, TRUE );
746 * Since the "fgAddToWindowDestroyList" function could easily have set the "ExecState"
747 * to stop, let's set it back to what it was.
749 fgState.ExecState = ExecState ;
753 * This function selects the current window
755 void FGAPIENTRY glutSetWindow( int ID )
757 SFG_Window* window = NULL;
760 * Make sure we don't get called too early
762 freeglut_assert_ready;
765 * Be wise. Be wise. Be wise. Be quick.
767 if( fgStructure.Window != NULL )
768 if( fgStructure.Window->ID == ID )
772 * Now we are sure there is sense in looking for the window
774 window = fgWindowByID( ID );
777 * In the case of an utter failure...
782 * ...issue a warning message and keep rolling on
784 fgWarning( "glutSetWindow(): window ID %i not found!", ID );
788 fgSetWindow ( window ) ;
792 * This function returns the ID number of the current window, 0 if none exists
794 int FGAPIENTRY glutGetWindow( void )
796 freeglut_assert_ready;
799 * Do we have a current window selected?
801 if( fgStructure.Window == NULL )
804 * Nope. Return zero to mark the state.
810 * Otherwise, return the ID of the current window
812 return( fgStructure.Window->ID );
816 * This function makes the current window visible
818 void FGAPIENTRY glutShowWindow( void )
820 freeglut_assert_ready; freeglut_assert_window;
822 #if TARGET_HOST_UNIX_X11
824 * Showing the window is done via mapping under X
826 XMapWindow( fgDisplay.Display, fgStructure.Window->Window.Handle );
827 XFlush( fgDisplay.Display );
829 #elif TARGET_HOST_WIN32
831 * Restore the window's originial position and size
833 ShowWindow( fgStructure.Window->Window.Handle, SW_SHOW );
839 * This function hides the current window
841 void FGAPIENTRY glutHideWindow( void )
843 freeglut_assert_ready; freeglut_assert_window;
845 #if TARGET_HOST_UNIX_X11
847 * The way we hide a window depends on if we're dealing
848 * with a top-level or children one...
850 if( fgStructure.Window->Parent == NULL )
853 * This is a top-level window
855 XWithdrawWindow( fgDisplay.Display, fgStructure.Window->Window.Handle, fgDisplay.Screen );
860 * Nope, it's a child window
862 XUnmapWindow( fgDisplay.Display, fgStructure.Window->Window.Handle );
866 * Flush the X state now
868 XFlush( fgDisplay.Display );
870 #elif TARGET_HOST_WIN32
874 ShowWindow( fgStructure.Window->Window.Handle, SW_HIDE );
880 * Iconify the current window (top-level windows only)
882 void FGAPIENTRY glutIconifyWindow( void )
884 freeglut_assert_ready; freeglut_assert_window;
886 #if TARGET_HOST_UNIX_X11
888 * Iconify the window and flush the X state
890 XIconifyWindow( fgDisplay.Display, fgStructure.Window->Window.Handle, fgDisplay.Screen );
891 XFlush( fgDisplay.Display );
893 #elif TARGET_HOST_WIN32
895 * Minimize the current window (this should be the same as X window iconifying)
897 ShowWindow( fgStructure.Window->Window.Handle, SW_MINIMIZE );
903 * Set the current window's title
905 void FGAPIENTRY glutSetWindowTitle( const char* title )
907 freeglut_assert_ready; freeglut_assert_window;
910 * Works only for top-level windows
912 if( fgStructure.Window->Parent != NULL )
915 #if TARGET_HOST_UNIX_X11
920 * Prepare the text properties
922 text.value = (unsigned char *) title;
923 text.encoding = XA_STRING;
925 text.nitems = strlen( title );
932 fgStructure.Window->Window.Handle,
937 * Have the X display state flushed
939 XFlush( fgDisplay.Display );
942 #elif TARGET_HOST_WIN32
944 * This seems to be a bit easier under Win32
946 SetWindowText( fgStructure.Window->Window.Handle, title );
952 * Set the current window's iconified title
954 void FGAPIENTRY glutSetIconTitle( const char* title )
956 freeglut_assert_ready; freeglut_assert_window;
959 * Works only for top-level windows
961 if( fgStructure.Window->Parent != NULL )
964 #if TARGET_HOST_UNIX_X11
969 * Prepare the text properties
971 text.value = (unsigned char *) title;
972 text.encoding = XA_STRING;
974 text.nitems = strlen( title );
981 fgStructure.Window->Window.Handle,
986 * Have the X display state flushed
988 XFlush( fgDisplay.Display );
991 #elif TARGET_HOST_WIN32
993 * This seems to be a bit easier under Win32
995 SetWindowText( fgStructure.Window->Window.Handle, title );
1001 * Change the current window's size
1003 void FGAPIENTRY glutReshapeWindow( int width, int height )
1005 freeglut_assert_ready; freeglut_assert_window;
1007 #if TARGET_HOST_UNIX_X11
1009 * Resize the window and flush the X state
1011 XResizeWindow( fgDisplay.Display, fgStructure.Window->Window.Handle, width, height );
1012 XFlush( fgDisplay.Display );
1014 #elif TARGET_HOST_WIN32
1020 * First off, grab the current window's position
1022 GetWindowRect( fgStructure.Window->Window.Handle, &winRect );
1026 if ( fgStructure.Window->Parent == NULL ) /* If this is not a subwindow ... */
1029 * Adjust the size of the window to allow for the size of the frame
1031 width += GetSystemMetrics( SM_CXSIZEFRAME ) * 2;
1032 height += GetSystemMetrics( SM_CYSIZEFRAME ) * 2 + GetSystemMetrics( SM_CYCAPTION );
1034 else /* This is a subwindow, get the parent window's position and subtract it off */
1036 GetWindowRect ( fgStructure.Window->Parent->Window.Handle, &winRect ) ;
1037 x -= winRect.left + GetSystemMetrics( SM_CXSIZEFRAME ) ;
1038 y -= winRect.top + GetSystemMetrics( SM_CYSIZEFRAME ) + GetSystemMetrics( SM_CYCAPTION ) ;
1042 * Resize the window, forcing a redraw to happen
1045 fgStructure.Window->Window.Handle,
1057 * Change the current window's position
1059 void FGAPIENTRY glutPositionWindow( int x, int y )
1061 freeglut_assert_ready; freeglut_assert_window;
1063 #if TARGET_HOST_UNIX_X11
1065 * Reposition the window and flush the X state
1067 XMoveWindow( fgDisplay.Display, fgStructure.Window->Window.Handle, x, y );
1068 XFlush( fgDisplay.Display );
1070 #elif TARGET_HOST_WIN32
1075 * First off, grab the current window's position
1077 GetWindowRect( fgStructure.Window->Window.Handle, &winRect );
1080 * Reposition the window, forcing a redraw to happen
1083 fgStructure.Window->Window.Handle,
1086 winRect.right - winRect.left,
1087 winRect.bottom - winRect.top,
1096 * Lowers the current window (by Z order change)
1098 void FGAPIENTRY glutPushWindow( void )
1100 freeglut_assert_ready; freeglut_assert_window;
1102 #if TARGET_HOST_UNIX_X11
1104 * Lower the current window
1106 XLowerWindow( fgDisplay.Display, fgStructure.Window->Window.Handle );
1108 #elif TARGET_HOST_WIN32
1110 * Set the new window's Z position, not affecting the rest of the settings:
1113 fgStructure.Window->Window.Handle,
1116 SWP_NOSIZE | SWP_NOMOVE
1123 * Raises the current window (by Z order change)
1125 void FGAPIENTRY glutPopWindow( void )
1127 freeglut_assert_ready; freeglut_assert_window;
1129 #if TARGET_HOST_UNIX_X11
1131 * Raise the current window
1133 XRaiseWindow( fgDisplay.Display, fgStructure.Window->Window.Handle );
1135 #elif TARGET_HOST_WIN32
1137 * Set the new window's Z position, not affecting the rest of the settings:
1140 fgStructure.Window->Window.Handle,
1143 SWP_NOSIZE | SWP_NOMOVE
1150 * Resize the current window so that it fits the whole screen
1152 void FGAPIENTRY glutFullScreen( void )
1154 freeglut_assert_ready; freeglut_assert_window;
1157 * Just have the window repositioned and resized
1159 glutPositionWindow( 0, 0 );
1162 fgDisplay.ScreenWidth,
1163 fgDisplay.ScreenHeight
1168 * A.Donev: Set and retrieve the window's user data
1170 void* FGAPIENTRY glutGetWindowData( void )
1172 return(fgStructure.Window->UserData);
1175 void FGAPIENTRY glutSetWindowData(void* data)
1177 fgStructure.Window->UserData=data;
1180 /*** END OF FILE ***/