X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_window.c;h=69afdf8641a0e188896dbe8b9d00880d2645bd98;hb=fe573d6af98de430357a7321cd50f5e92e9a2aab;hp=325005a3844ac5b874ddf5c9e3d0b5b8ae61e87d;hpb=81f7f85ade2f873ebee9afa3ad810046771cb5c3;p=freeglut diff --git a/src/freeglut_window.c b/src/freeglut_window.c index 325005a..69afdf8 100644 --- a/src/freeglut_window.c +++ b/src/freeglut_window.c @@ -173,10 +173,10 @@ XVisualInfo* fgChooseVisual( void ) * Setup the pixel format for a Win32 window */ #if TARGET_HOST_MS_WINDOWS -/* WRONG-- FIXME */ /* The following include file is available from SGI but is not standard: * #include * So we copy the necessary parts out of it. + * XXX: should local definitions for extensions be put in a separate include file? */ typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc); @@ -400,7 +400,8 @@ void fgSetWindow ( SFG_Window *window ) * to the freeglut structure. OpenGL context is created here. */ void fgOpenWindow( SFG_Window* window, const char* title, - int x, int y, int w, int h, + GLboolean positionUse, int x, int y, + GLboolean sizeUse, int w, int h, GLboolean gameMode, GLboolean isSubWindow ) { #if TARGET_HOST_POSIX_X11 @@ -477,6 +478,11 @@ void fgOpenWindow( SFG_Window* window, const char* title, mask |= CWOverrideRedirect; } + if( ! positionUse ) + x = y = -1; /* default window position */ + if( ! sizeUse ) + w = h = 300; /* default window size */ + window->Window.Handle = XCreateWindow( fgDisplay.Display, window->Parent == NULL ? fgDisplay.RootWindow : @@ -549,9 +555,9 @@ void fgOpenWindow( SFG_Window* window, const char* title, window->State.Visible = GL_TRUE; sizeHints.flags = 0; - if ( fgState.Position.Use ) + if ( positionUse ) sizeHints.flags |= USPosition; - if ( fgState.Size.Use ) + if ( sizeUse ) sizeHints.flags |= USSize; /* @@ -622,6 +628,8 @@ void fgOpenWindow( SFG_Window* window, const char* title, } else { + int worig = w, horig = h; + #if !defined(_WIN32_WCE) if ( ( ! isSubWindow ) && ( ! window->IsMenu ) ) { @@ -636,15 +644,27 @@ void fgOpenWindow( SFG_Window* window, const char* title, } #endif /* defined(_WIN32_WCE) */ - if( ! fgState.Position.Use ) + if( ! positionUse ) { x = CW_USEDEFAULT; y = CW_USEDEFAULT; } - if( ! fgState.Size.Use ) + /* setting State.Width/Height to call resize callback later */ + if( ! sizeUse ) + { + if( ! window->IsMenu ) + { + w = CW_USEDEFAULT; + h = CW_USEDEFAULT; + } + else /* fail safe - Windows can make a window of size (0, 0) */ + w = h = 300; /* default window size */ + window->State.Width = window->State.Height = -1; + } + else { - w = CW_USEDEFAULT; - h = CW_USEDEFAULT; + window->State.Width = worig; + window->State.Height = horig; } /* @@ -790,9 +810,10 @@ int FGAPIENTRY glutCreateWindow( const char* title ) */ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCreateWindow" ); - return fgCreateWindow( NULL, title, fgState.Position.X, fgState.Position.Y, - fgState.Size.X, fgState.Size.Y, GL_FALSE, - GL_FALSE )->ID; + return fgCreateWindow( NULL, title, fgState.Position.Use, + fgState.Position.X, fgState.Position.Y, + fgState.Size.Use, fgState.Size.X, fgState.Size.Y, + GL_FALSE, GL_FALSE )->ID; } /* @@ -833,7 +854,7 @@ int FGAPIENTRY glutCreateSubWindow( int parentID, int x, int y, int w, int h ) h = -h ; } - window = fgCreateWindow( parent, "", x, y, w, h, GL_FALSE, GL_FALSE ); + window = fgCreateWindow( parent, "", GL_TRUE, x, y, GL_TRUE, w, h, GL_FALSE, GL_FALSE ); ret = window->ID; return ret;