X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_structure.c;h=482740e2605c1777bab1a263d1707451eab65ff1;hb=4634982c39857ee13ad0c5fa67b3ad197a37daf1;hp=16100560e53843150f5e4ca4f07f948290b89895;hpb=d296a46a2dccdd99048541e1f8ca0ef010ac8545;p=freeglut diff --git a/src/freeglut_structure.c b/src/freeglut_structure.c index 1610056..482740e 100644 --- a/src/freeglut_structure.c +++ b/src/freeglut_structure.c @@ -25,14 +25,9 @@ * 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" - /* -- GLOBAL EXPORTS ------------------------------------------------------- */ /* @@ -75,7 +70,6 @@ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title, { /* Have the window object created */ SFG_Window *window = (SFG_Window *)calloc( sizeof(SFG_Window), 1 ); - int fakeArgc = 0; fghClearCallBacks( window ); @@ -105,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; } @@ -120,9 +114,8 @@ SFG_Menu* fgCreateMenu( FGCBMenu menuCallback ) /* Have the menu object created */ SFG_Menu* menu = (SFG_Menu *)calloc( sizeof(SFG_Menu), 1 ); - int fakeArgc = 0; - menu->ParentWindow = fgStructure.Window; + menu->ParentWindow = NULL; /* Create a window for the menu to reside in. */ @@ -199,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" ); @@ -221,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 ); @@ -241,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): @@ -325,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 )