don't show window when creating menu (better fix then making it very small and hiding it asap...

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1579 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
dcnieho 2013-04-04 04:28:53 +00:00
parent 9495df62ee
commit 62b5dadbe3
4 changed files with 16 additions and 26 deletions

View File

@ -113,7 +113,6 @@ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title,
*/ */
SFG_Menu* fgCreateMenu( FGCBMenu menuCallback ) SFG_Menu* fgCreateMenu( FGCBMenu menuCallback )
{ {
int x = 100, y = 100, w = 1, h = 1;
SFG_Window *current_window = fgStructure.CurrentWindow; SFG_Window *current_window = fgStructure.CurrentWindow;
/* Have the menu object created */ /* Have the menu object created */
@ -122,13 +121,11 @@ SFG_Menu* fgCreateMenu( FGCBMenu menuCallback )
menu->ParentWindow = NULL; menu->ParentWindow = NULL;
/* Create a window for the menu to reside in. */ /* Create a window for the menu to reside in. */
fgCreateWindow( NULL, "freeglut menu", GL_FALSE, 0, 0, GL_FALSE, 0, 0,
fgCreateWindow( NULL, "freeglut menu", GL_TRUE, x, y, GL_TRUE, w, h,
GL_FALSE, GL_TRUE ); GL_FALSE, GL_TRUE );
menu->Window = fgStructure.CurrentWindow; menu->Window = fgStructure.CurrentWindow;
glutDisplayFunc( fgDisplayMenu ); glutDisplayFunc( fgDisplayMenu );
glutHideWindow( ); /* Hide the window for now */
fgSetWindow( current_window ); fgSetWindow( current_window );
/* Initialize the object properties: */ /* Initialize the object properties: */

View File

@ -120,10 +120,10 @@ void fgOpenWindow( SFG_Window* window, const char* title,
GLboolean sizeUse, int w, int h, GLboolean sizeUse, int w, int h,
GLboolean gameMode, GLboolean isSubWindow ) GLboolean gameMode, GLboolean isSubWindow )
{ {
fgPlatformOpenWindow( window, title, fgPlatformOpenWindow( window, title,
positionUse, x, y, positionUse, x, y,
sizeUse, w, h, sizeUse, w, h,
gameMode, isSubWindow ); gameMode, isSubWindow );
fgSetWindow( window ); fgSetWindow( window );

View File

@ -636,17 +636,11 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title,
} }
if( !sizeUse ) if( !sizeUse )
{ {
if( !window->IsMenu ) w = CW_USEDEFAULT;
{ h = CW_USEDEFAULT;
w = CW_USEDEFAULT;
h = CW_USEDEFAULT;
}
else /* fail safe - Windows can make a window of size (0, 0) */
w = h = 300; /* default window size */
} }
#if !defined(_WIN32_WCE) /* no decorations for windows CE, so nothing to do */
#if !defined(_WIN32_WCE) /* no decorations for windows CE */ else
if( sizeUse )
{ {
RECT windowRect; RECT windowRect;
/* /*
@ -742,8 +736,9 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title,
#if defined(_WIN32_WCE) #if defined(_WIN32_WCE)
ShowWindow( window->Window.Handle, SW_SHOW ); ShowWindow( window->Window.Handle, SW_SHOW );
#else #else
if (!window->IsMenu) /* Don't show window after creation if its a menu */
{ {
BOOL iconic = fgState.ForceIconic && !window->IsMenu && !gameMode && !isSubWindow; BOOL iconic = fgState.ForceIconic && !gameMode && !isSubWindow;
ShowWindow( window->Window.Handle, ShowWindow( window->Window.Handle,
iconic ? SW_SHOWMINIMIZED : SW_SHOWNORMAL ); iconic ? SW_SHOWMINIMIZED : SW_SHOWNORMAL );
} }

View File

@ -300,12 +300,6 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title,
} }
#endif #endif
/*
* XXX Assume the new window is visible by default
* XXX Is this a safe assumption?
*/
window->State.Visible = GL_TRUE;
sizeHints.flags = 0; sizeHints.flags = 0;
if ( positionUse ) if ( positionUse )
sizeHints.flags |= USPosition; sizeHints.flags |= USPosition;
@ -362,7 +356,11 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title,
fgRegisterDevices( fgDisplay.pDisplay.Display, &(window->Window.Handle) ); fgRegisterDevices( fgDisplay.pDisplay.Display, &(window->Window.Handle) );
#endif #endif
XMapWindow( fgDisplay.pDisplay.Display, window->Window.Handle ); if (!window->IsMenu) /* Don't show window after creation if its a menu */
{
XMapWindow( fgDisplay.pDisplay.Display, window->Window.Handle );
window->State.Visible = GL_TRUE;
}
XFree(visualInfo); XFree(visualInfo);