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:
parent
22b6c59f34
commit
d161195cb4
@ -425,7 +425,7 @@ int FGAPIENTRY glutEnterGameMode( void )
|
|||||||
|
|
||||||
fgStructure.GameMode = fgCreateWindow(
|
fgStructure.GameMode = fgCreateWindow(
|
||||||
NULL, "FREEGLUT", 0, 0,
|
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
|
#if TARGET_HOST_UNIX_X11
|
||||||
|
@ -76,7 +76,6 @@ SFG_State fgState = { { -1, -1, GL_FALSE }, /* Position */
|
|||||||
#endif
|
#endif
|
||||||
{ NULL, NULL }, /* Timers */
|
{ NULL, NULL }, /* Timers */
|
||||||
NULL, /* IdleCallback */
|
NULL, /* IdleCallback */
|
||||||
GL_FALSE, /* BuildingAMenu */
|
|
||||||
0, /* ActiveMenus */
|
0, /* ActiveMenus */
|
||||||
NULL, /* MenuStateCallback */
|
NULL, /* MenuStateCallback */
|
||||||
NULL, /* MenuStatusCallback */
|
NULL, /* MenuStatusCallback */
|
||||||
|
@ -240,7 +240,6 @@ struct tagSFG_State
|
|||||||
|
|
||||||
FGCBIdle IdleCallback; /* The global idle callback */
|
FGCBIdle IdleCallback; /* The global idle callback */
|
||||||
|
|
||||||
GLboolean BuildingAMenu; /* Are we presently making a menu */
|
|
||||||
int ActiveMenus; /* Num. of currently active menus */
|
int ActiveMenus; /* Num. of currently active menus */
|
||||||
FGCBMenuState MenuStateCallback; /* Menu callbacks are global */
|
FGCBMenuState MenuStateCallback; /* Menu callbacks are global */
|
||||||
FGCBMenuStatus MenuStatusCallback;
|
FGCBMenuStatus MenuStatusCallback;
|
||||||
@ -705,7 +704,8 @@ GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
|
|||||||
* Defined in freeglut_structure.c, freeglut_window.c.
|
* Defined in freeglut_structure.c, freeglut_window.c.
|
||||||
*/
|
*/
|
||||||
SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title,
|
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 fgSetWindow ( SFG_Window *window );
|
||||||
void fgOpenWindow( SFG_Window* window, const char* title,
|
void fgOpenWindow( SFG_Window* window, const char* title,
|
||||||
int x, int y, int w, int h, GLboolean gameMode,
|
int x, int y, int w, int h, GLboolean gameMode,
|
||||||
|
@ -1100,7 +1100,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
|
|||||||
|
|
||||||
window->Window.Handle = hWnd;
|
window->Window.Handle = hWnd;
|
||||||
window->Window.Device = GetDC( hWnd );
|
window->Window.Device = GetDC( hWnd );
|
||||||
if( fgState.BuildingAMenu )
|
if( window->IsMenu )
|
||||||
{
|
{
|
||||||
unsigned int current_DisplayMode = fgState.DisplayMode;
|
unsigned int current_DisplayMode = fgState.DisplayMode;
|
||||||
fgState.DisplayMode = GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH;
|
fgState.DisplayMode = GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH;
|
||||||
|
@ -69,7 +69,8 @@ void fgClearCallBacks( SFG_Window *window )
|
|||||||
* If parent is set to NULL, the window created will be a topmost one.
|
* If parent is set to NULL, the window created will be a topmost one.
|
||||||
*/
|
*/
|
||||||
SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title,
|
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
|
* 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.Cursor = GLUT_CURSOR_INHERIT;
|
||||||
window->State.Modifiers = 0xffffffff;
|
window->State.Modifiers = 0xffffffff;
|
||||||
|
|
||||||
window->IsMenu = fgState.BuildingAMenu ;
|
window->IsMenu = isMenu;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open the window now. The fgOpenWindow() function is system
|
* Open the window now. The fgOpenWindow() function is system
|
||||||
@ -142,22 +143,13 @@ SFG_Menu* fgCreateMenu( FGCBMenu menuCallback )
|
|||||||
menu->ParentWindow = fgStructure.Window;
|
menu->ParentWindow = fgStructure.Window;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a window for the menu to reside in. Set the
|
* Create a window for the menu to reside in.
|
||||||
* global variable BuildingAMenu to true so we can ensure
|
|
||||||
* it is created without decorations.
|
|
||||||
*/
|
*/
|
||||||
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;
|
menu->Window = fgStructure.Window;
|
||||||
glutDisplayFunc( fgDisplayMenu );
|
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 */
|
glutHideWindow( ); /* Hide the window for now */
|
||||||
fgSetWindow( current_window );
|
fgSetWindow( current_window );
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
|
|||||||
* XXX With a little thought, we should be able to greatly
|
* XXX With a little thought, we should be able to greatly
|
||||||
* XXX simplify this.
|
* XXX simplify this.
|
||||||
*/
|
*/
|
||||||
if ( !fgState.BuildingAMenu )
|
if ( !window->IsMenu )
|
||||||
window->Window.VisualInfo = fgChooseVisual();
|
window->Window.VisualInfo = fgChooseVisual();
|
||||||
else if ( fgStructure.MenuContext )
|
else if ( fgStructure.MenuContext )
|
||||||
window->Window.VisualInfo = fgChooseVisual();
|
window->Window.VisualInfo = fgChooseVisual();
|
||||||
@ -327,7 +327,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
|
|||||||
|
|
||||||
mask = CWBackPixmap | CWBorderPixel | CWColormap | CWEventMask;
|
mask = CWBackPixmap | CWBorderPixel | CWColormap | CWEventMask;
|
||||||
|
|
||||||
if ( fgState.BuildingAMenu )
|
if ( window->IsMenu )
|
||||||
{
|
{
|
||||||
winAttr.override_redirect = True;
|
winAttr.override_redirect = True;
|
||||||
mask |= CWOverrideRedirect;
|
mask |= CWOverrideRedirect;
|
||||||
@ -347,7 +347,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
|
|||||||
* The GLX context creation, possibly trying the direct context rendering
|
* The GLX context creation, possibly trying the direct context rendering
|
||||||
* or else use the current context if the user has so specified
|
* 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
|
* 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 )
|
int FGAPIENTRY glutCreateWindow( const char* title )
|
||||||
{
|
{
|
||||||
return fgCreateWindow( NULL, title, fgState.Position.X, fgState.Position.Y,
|
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;
|
freeglut_assert_ready;
|
||||||
parent = fgWindowByID( parentID );
|
parent = fgWindowByID( parentID );
|
||||||
freeglut_return_val_if_fail( parent != NULL, 0 );
|
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;
|
return window->ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user