Removed the state variable BuildingAMenu.

Instead pass a new parameter isMenu to fgCreateWindow().
Elsewhere use window->IsMenu.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@354 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
cjp 2003-11-15 19:25:22 +00:00
parent 22b6c59f34
commit d161195cb4
6 changed files with 15 additions and 23 deletions

View File

@ -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

View File

@ -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 */

View File

@ -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,

View File

@ -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;

View File

@ -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 );

View File

@ -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;
}