diff --git a/freeglut/freeglut/src/freeglut_gamemode.c b/freeglut/freeglut/src/freeglut_gamemode.c index 06ca767..7c9b7eb 100644 --- a/freeglut/freeglut/src/freeglut_gamemode.c +++ b/freeglut/freeglut/src/freeglut_gamemode.c @@ -425,7 +425,7 @@ int FGAPIENTRY glutEnterGameMode( void ) fgStructure.GameMode = fgCreateWindow( NULL, "FREEGLUT", 0, 0, - fgState.GameModeSize.X, fgState.GameModeSize.Y, GL_TRUE + fgState.GameModeSize.X, fgState.GameModeSize.Y, GL_TRUE, GL_FALSE ); #if TARGET_HOST_UNIX_X11 diff --git a/freeglut/freeglut/src/freeglut_init.c b/freeglut/freeglut/src/freeglut_init.c index 539fe83..fd864e8 100644 --- a/freeglut/freeglut/src/freeglut_init.c +++ b/freeglut/freeglut/src/freeglut_init.c @@ -76,7 +76,6 @@ SFG_State fgState = { { -1, -1, GL_FALSE }, /* Position */ #endif { NULL, NULL }, /* Timers */ NULL, /* IdleCallback */ - GL_FALSE, /* BuildingAMenu */ 0, /* ActiveMenus */ NULL, /* MenuStateCallback */ NULL, /* MenuStatusCallback */ diff --git a/freeglut/freeglut/src/freeglut_internal.h b/freeglut/freeglut/src/freeglut_internal.h index ea75e84..dec9867 100644 --- a/freeglut/freeglut/src/freeglut_internal.h +++ b/freeglut/freeglut/src/freeglut_internal.h @@ -240,7 +240,6 @@ struct tagSFG_State FGCBIdle IdleCallback; /* The global idle callback */ - GLboolean BuildingAMenu; /* Are we presently making a menu */ int ActiveMenus; /* Num. of currently active menus */ FGCBMenuState MenuStateCallback; /* Menu callbacks are global */ FGCBMenuStatus MenuStatusCallback; @@ -705,7 +704,8 @@ GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly, * Defined in freeglut_structure.c, freeglut_window.c. */ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title, - int x, int y, int w, int h, GLboolean gameMode ); + int x, int y, int w, int h, + GLboolean gameMode, GLboolean isMenu ); void fgSetWindow ( SFG_Window *window ); void fgOpenWindow( SFG_Window* window, const char* title, int x, int y, int w, int h, GLboolean gameMode, diff --git a/freeglut/freeglut/src/freeglut_main.c b/freeglut/freeglut/src/freeglut_main.c index 1d52c05..f3d70ef 100644 --- a/freeglut/freeglut/src/freeglut_main.c +++ b/freeglut/freeglut/src/freeglut_main.c @@ -1100,7 +1100,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, window->Window.Handle = hWnd; window->Window.Device = GetDC( hWnd ); - if( fgState.BuildingAMenu ) + if( window->IsMenu ) { unsigned int current_DisplayMode = fgState.DisplayMode; fgState.DisplayMode = GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH; diff --git a/freeglut/freeglut/src/freeglut_structure.c b/freeglut/freeglut/src/freeglut_structure.c index 2871e32..3e55bfd 100644 --- a/freeglut/freeglut/src/freeglut_structure.c +++ b/freeglut/freeglut/src/freeglut_structure.c @@ -69,7 +69,8 @@ void fgClearCallBacks( SFG_Window *window ) * If parent is set to NULL, the window created will be a topmost one. */ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title, - int x, int y, int w, int h, GLboolean gameMode ) + int x, int y, int w, int h, + GLboolean gameMode, GLboolean isMenu ) { /* * Have the window object created @@ -106,7 +107,7 @@ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title, window->State.Cursor = GLUT_CURSOR_INHERIT; window->State.Modifiers = 0xffffffff; - window->IsMenu = fgState.BuildingAMenu ; + window->IsMenu = isMenu; /* * Open the window now. The fgOpenWindow() function is system @@ -142,22 +143,13 @@ SFG_Menu* fgCreateMenu( FGCBMenu menuCallback ) menu->ParentWindow = fgStructure.Window; /* - * Create a window for the menu to reside in. Set the - * global variable BuildingAMenu to true so we can ensure - * it is created without decorations. + * Create a window for the menu to reside in. */ - fgState.BuildingAMenu = GL_TRUE; - fgCreateWindow( NULL, NULL, x, y, w, h, GL_FALSE ); + fgCreateWindow( NULL, NULL, x, y, w, h, GL_FALSE, GL_TRUE ); menu->Window = fgStructure.Window; glutDisplayFunc( fgDisplayMenu ); - /* - * While BuildingAMenu is true, all windows built have no decorations. - * That's not a good default behavior, so let's set it false again. - */ - fgState.BuildingAMenu = GL_FALSE; - glutHideWindow( ); /* Hide the window for now */ fgSetWindow( current_window ); diff --git a/freeglut/freeglut/src/freeglut_window.c b/freeglut/freeglut/src/freeglut_window.c index 907696d..ac20d1b 100644 --- a/freeglut/freeglut/src/freeglut_window.c +++ b/freeglut/freeglut/src/freeglut_window.c @@ -265,7 +265,7 @@ void fgOpenWindow( SFG_Window* window, const char* title, * XXX With a little thought, we should be able to greatly * XXX simplify this. */ - if ( !fgState.BuildingAMenu ) + if ( !window->IsMenu ) window->Window.VisualInfo = fgChooseVisual(); else if ( fgStructure.MenuContext ) window->Window.VisualInfo = fgChooseVisual(); @@ -327,7 +327,7 @@ void fgOpenWindow( SFG_Window* window, const char* title, mask = CWBackPixmap | CWBorderPixel | CWColormap | CWEventMask; - if ( fgState.BuildingAMenu ) + if ( window->IsMenu ) { winAttr.override_redirect = True; mask |= CWOverrideRedirect; @@ -347,7 +347,7 @@ void fgOpenWindow( SFG_Window* window, const char* title, * The GLX context creation, possibly trying the direct context rendering * or else use the current context if the user has so specified */ - if ( fgState.BuildingAMenu ) + if ( window->IsMenu ) { /* * If there isn't already an OpenGL rendering context for menu @@ -573,7 +573,8 @@ void fgCloseWindow( SFG_Window* window ) int FGAPIENTRY glutCreateWindow( const char* title ) { return fgCreateWindow( NULL, title, fgState.Position.X, fgState.Position.Y, - fgState.Size.X, fgState.Size.Y, GL_FALSE )->ID; + fgState.Size.X, fgState.Size.Y, GL_FALSE, + GL_FALSE )->ID; } /* @@ -587,7 +588,7 @@ int FGAPIENTRY glutCreateSubWindow( int parentID, int x, int y, int w, int h ) freeglut_assert_ready; parent = fgWindowByID( parentID ); freeglut_return_val_if_fail( parent != NULL, 0 ); - window = fgCreateWindow( parent, "", x, y, w, h, GL_FALSE ); + window = fgCreateWindow( parent, "", x, y, w, h, GL_FALSE, GL_FALSE ); return window->ID; }