X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_init.c;h=d5a5aa64bc68b72f7a5a2962ed92fa61383ab458;hb=f075b2126dff4d88bc2811281f0d27e7c0581ab4;hp=5c92464dc69a0a20fe91482117c9f90023cdda2e;hpb=45386a7fdf1d3e2e97f4a8f6928cfcff6a7534c6;p=freeglut diff --git a/src/freeglut_init.c b/src/freeglut_init.c index 5c92464..d5a5aa6 100644 --- a/src/freeglut_init.c +++ b/src/freeglut_init.c @@ -25,10 +25,6 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include "freeglut_internal.h" @@ -183,7 +179,7 @@ static void fghInitialize( const char* displayName ) /* Register the window class */ atom = RegisterClass( &wc ); - assert( atom ); + FREEGLUT_INTERNAL_ERROR_EXIT ( atom, "Window Class Not Registered", "fghInitialize" ); } /* The screen dimensions can be obtained via GetSystemMetrics() calls */ @@ -219,8 +215,6 @@ void fgDeinitialize( void ) return; } - /* fgState.Initialised = GL_FALSE; */ - /* If there was a menu created, destroy the rendering context */ if( fgStructure.MenuContext ) { @@ -230,13 +224,13 @@ void fgDeinitialize( void ) fgDestroyStructure( ); - while( timer = fgState.Timers.First ) + while( ( timer = fgState.Timers.First) ) { fgListRemove( &fgState.Timers, &timer->Node ); free( timer ); } - while( timer = fgState.FreeTimers.First ) + while( ( timer = fgState.FreeTimers.First) ) { fgListRemove( &fgState.FreeTimers, &timer->Node ); free( timer ); @@ -311,6 +305,8 @@ void fgDeinitialize( void ) XCloseDisplay( fgDisplay.Display ); #endif + + fgState.Initialised = GL_FALSE; } /* @@ -594,11 +590,8 @@ void FGAPIENTRY glutInit( int* pargc, char** argv ) } } - /* - * Compact {argv}. - */ - j = 1; - for( i = 1; i < *pargc; i++, j++ ) + /* Compact {argv}. */ + for( i = j = 1; i < *pargc; i++, j++ ) { /* Guaranteed to end because there are "*pargc" arguments left */ while ( argv[ j ] == NULL ) @@ -623,9 +616,13 @@ void FGAPIENTRY glutInit( int* pargc, char** argv ) if (geometry ) { + unsigned int parsedWidth, parsedHeight; int mask = XParseGeometry( geometry, &fgState.Position.X, &fgState.Position.Y, - &fgState.Size.X, &fgState.Size.Y ); + &parsedWidth, &parsedHeight ); + /* TODO: Check for overflow? */ + fgState.Size.X = parsedWidth; + fgState.Size.Y = parsedHeight; if( (mask & (WidthValue|HeightValue)) == (WidthValue|HeightValue) ) fgState.Size.Use = GL_TRUE;