X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_init.c;h=36b5b4bef9c2fbffdac818d16a01d854be71279f;hb=7c8806280d824b872cb97a684172ed3531c5ed11;hp=a1367b82d905bec95cf0ccf8796191d072a21813;hpb=646676b8dbf8ab504ac8a275fe9a63a403a3190b;p=freeglut diff --git a/src/freeglut_init.c b/src/freeglut_init.c index a1367b8..36b5b4b 100644 --- a/src/freeglut_init.c +++ b/src/freeglut_init.c @@ -61,19 +61,22 @@ SFG_State fgState = { { -1, -1, FALSE }, /* Position */ FALSE, /* ForceDirectContext */ TRUE, /* TryDirectContext */ FALSE, /* ForceIconic */ + FALSE, /* UseCurrentContext */ FALSE, /* GLDebugSwitch */ FALSE, /* XSyncSwitch */ TRUE, /* IgnoreKeyRepeat */ 0, /* FPSInterval */ 0, /* SwapCount */ 0, /* SwapTime */ -#ifdef TARGET_HOST_WIN32 +#if TARGET_HOST_WIN32 { 0, FALSE }, /* Time */ #else { { 0, 0 }, FALSE }, #endif { NULL, NULL }, /* Timers */ NULL, /* IdleCallback */ + FALSE, /* BuildingAMenu */ + 0, /* ActiveMenus */ NULL, /* MenuStateCallback */ NULL, /* MenuStatusCallback */ { 640, 480, TRUE }, /* GameModeSize */ @@ -81,7 +84,7 @@ SFG_State fgState = { { -1, -1, FALSE }, /* Position */ 72, /* GameModeRefresh */ GLUT_ACTION_EXIT, /* ActionOnWindowClose */ GLUT_EXEC_STATE_INIT /* ExecState */ -}; +} ; /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */ @@ -268,6 +271,15 @@ void fgDeinitialize( void ) } /* + * If there was a menu created, destroy the rendering context + */ + if ( fgStructure.MenuContext ) + { + free ( fgStructure.MenuContext ) ; + fgStructure.MenuContext = NULL ; + } + + /* * Perform the freeglut structure deinitialization */ fgDestroyStructure(); @@ -275,7 +287,7 @@ void fgDeinitialize( void ) /* * Delete all the timers and their storage list */ - while ( (timer = fgState.Timers.First) != NULL ) + while ( (timer = (SFG_Timer *)fgState.Timers.First) != NULL ) { fgListRemove ( &fgState.Timers, &timer->Node ) ; free ( timer ) ; @@ -306,6 +318,7 @@ void fgDeinitialize( void ) fgState.ForceDirectContext = FALSE; fgState.TryDirectContext = TRUE; fgState.ForceIconic = FALSE; + fgState.UseCurrentContext = FALSE; fgState.GLDebugSwitch = FALSE; fgState.XSyncSwitch = FALSE; fgState.ActionOnWindowClose = GLUT_ACTION_EXIT ; @@ -394,12 +407,13 @@ void FGAPIENTRY glutInit( int* pargc, char** argv ) /* check if GLUT_FPS env var is set */ { - const char *fps = getenv("GLUT_FPS"); - if (fps) { - sscanf(fps, "%d", &fgState.FPSInterval); - if (fgState.FPSInterval <= 0) - fgState.FPSInterval = 5000; /* 5000 milliseconds */ - } + const char *fps = getenv ( "GLUT_FPS" ); + if ( fps ) + { + sscanf ( fps, "%d", &fgState.FPSInterval ) ; + if ( fgState.FPSInterval <= 0 ) + fgState.FPSInterval = 5000 ; /* 5000 milliseconds */ + } } /* @@ -971,7 +985,7 @@ void FGAPIENTRY glutInitDisplayString( const char* displayMode ) */ char *token ; int len = strlen ( displayMode ) ; - char *buffer = malloc ( (len+1) * sizeof(char) ) ; + char *buffer = (char *)malloc ( (len+1) * sizeof(char) ) ; memcpy ( buffer, displayMode, len ) ; buffer[len] = '\0' ; @@ -1062,42 +1076,42 @@ void FGAPIENTRY glutInitDisplayString( const char* displayMode ) break ; case 20 : /* "win32pdf": matches the Win32 Pixel Format Descriptor by number */ -#ifdef TARGET_HOST_WIN32 +#if TARGET_HOST_WIN32 #endif break ; case 21 : /* "xvisual": matches the X visual ID by number */ -#ifdef TARGET_HOST_UNIX_X11 +#if TARGET_HOST_UNIX_X11 #endif break ; case 22 : /* "xstaticgray": boolean indicating if the frame buffer configuration's X visual is of type StaticGray */ -#ifdef TARGET_HOST_UNIX_X11 +#if TARGET_HOST_UNIX_X11 #endif break ; case 23 : /* "xgrayscale": boolean indicating if the frame buffer configuration's X visual is of type GrayScale */ -#ifdef TARGET_HOST_UNIX_X11 +#if TARGET_HOST_UNIX_X11 #endif break ; case 24 : /* "xstaticcolor": boolean indicating if the frame buffer configuration's X visual is of type StaticColor */ -#ifdef TARGET_HOST_UNIX_X11 +#if TARGET_HOST_UNIX_X11 #endif break ; case 25 : /* "xpseudocolor": boolean indicating if the frame buffer configuration's X visual is of type PseudoColor */ -#ifdef TARGET_HOST_UNIX_X11 +#if TARGET_HOST_UNIX_X11 #endif break ; case 26 : /* "xtruecolor": boolean indicating if the frame buffer configuration's X visual is of type TrueColor */ -#ifdef TARGET_HOST_UNIX_X11 +#if TARGET_HOST_UNIX_X11 #endif break ; case 27 : /* "xdirectcolor": boolean indicating if the frame buffer configuration's X visual is of type DirectColor */ -#ifdef TARGET_HOST_UNIX_X11 +#if TARGET_HOST_UNIX_X11 #endif break ;