X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_structure.c;h=482740e2605c1777bab1a263d1707451eab65ff1;hb=3279d109029a83b1ab7f07cfac0ddd8cc8a7cce5;hp=07bf892e92ac6feca17ad6e36120d2d346900bad;hpb=0fd65e65061141e7317caba38801580374f09d0b;p=freeglut diff --git a/src/freeglut_structure.c b/src/freeglut_structure.c index 07bf892..482740e 100644 --- a/src/freeglut_structure.c +++ b/src/freeglut_structure.c @@ -99,7 +99,7 @@ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title, * dependant, and resides in freeglut_window.c. Uses fgState. */ fgOpenWindow( window, title, x, y, w, h, gameMode, - parent ? GL_TRUE : GL_FALSE ); + (GLboolean)(parent ? GL_TRUE : GL_FALSE) ); return window; } @@ -115,7 +115,7 @@ SFG_Menu* fgCreateMenu( FGCBMenu menuCallback ) /* Have the menu object created */ SFG_Menu* menu = (SFG_Menu *)calloc( sizeof(SFG_Menu), 1 ); - menu->ParentWindow = fgStructure.Window; + menu->ParentWindow = NULL; /* Create a window for the menu to reside in. */ @@ -192,8 +192,6 @@ void fgCloseWindows( ) */ void fgDestroyWindow( SFG_Window* window ) { - int menu_index; - FREEGLUT_INTERNAL_ERROR_EXIT ( window, "Window destroy function called with null window", "fgDestroyWindow" ); @@ -214,10 +212,6 @@ void fgDestroyWindow( SFG_Window* window ) if( window->ActiveMenu ) fgDeactivateMenu( window ); - for( menu_index = 0; menu_index < 3; menu_index ++ ) - if( window->Menu[ menu_index ] ) - window->Menu[ menu_index ]->ParentWindow = NULL; - fghClearCallBacks( window ); fgCloseWindow( window ); free( window ); @@ -234,6 +228,10 @@ static void fghRemoveMenuFromWindow( SFG_Window* window, SFG_Menu* menu ) SFG_Window *subWindow; int i; + /* Check whether this is the active menu in the window */ + if ( menu == window->ActiveMenu ) + window->ActiveMenu = NULL ; + /* * Check if the menu is attached to the current window, * if so, have it detached (by overwriting with a NULL): @@ -318,7 +316,7 @@ void fgDestroyMenu( SFG_Menu* menu ) } if( fgStructure.Window == menu->Window ) - fgSetWindow( menu->ParentWindow ); + fgSetWindow( NULL ); fgDestroyWindow( menu->Window ); fgListRemove( &fgStructure.Menus, &menu->Node ); if( fgStructure.Menu == menu )