From: Diederick Niehorster Date: Thu, 4 Apr 2013 04:28:53 +0000 (+0000) Subject: don't show window when creating menu (better fix then making it very small and hiding... X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;h=26913c37ab4ecff6a3d43c1e1dfcd58141079e60;p=freeglut don't show window when creating menu (better fix then making it very small and hiding it asap... git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1579 7f0cb862-5218-0410-a997-914c9d46530a --- diff --git a/src/fg_structure.c b/src/fg_structure.c index d50063f..1d6c3a6 100644 --- a/src/fg_structure.c +++ b/src/fg_structure.c @@ -113,7 +113,6 @@ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title, */ SFG_Menu* fgCreateMenu( FGCBMenu menuCallback ) { - int x = 100, y = 100, w = 1, h = 1; SFG_Window *current_window = fgStructure.CurrentWindow; /* Have the menu object created */ @@ -122,13 +121,11 @@ SFG_Menu* fgCreateMenu( FGCBMenu menuCallback ) menu->ParentWindow = NULL; /* Create a window for the menu to reside in. */ - - fgCreateWindow( NULL, "freeglut menu", GL_TRUE, x, y, GL_TRUE, w, h, + fgCreateWindow( NULL, "freeglut menu", GL_FALSE, 0, 0, GL_FALSE, 0, 0, GL_FALSE, GL_TRUE ); menu->Window = fgStructure.CurrentWindow; glutDisplayFunc( fgDisplayMenu ); - glutHideWindow( ); /* Hide the window for now */ fgSetWindow( current_window ); /* Initialize the object properties: */ diff --git a/src/fg_window.c b/src/fg_window.c index 1a65c1f..d24f7cd 100644 --- a/src/fg_window.c +++ b/src/fg_window.c @@ -120,10 +120,10 @@ void fgOpenWindow( SFG_Window* window, const char* title, GLboolean sizeUse, int w, int h, GLboolean gameMode, GLboolean isSubWindow ) { - fgPlatformOpenWindow( window, title, - positionUse, x, y, - sizeUse, w, h, - gameMode, isSubWindow ); + fgPlatformOpenWindow( window, title, + positionUse, x, y, + sizeUse, w, h, + gameMode, isSubWindow ); fgSetWindow( window ); diff --git a/src/mswin/fg_window_mswin.c b/src/mswin/fg_window_mswin.c index 3290913..6047e42 100644 --- a/src/mswin/fg_window_mswin.c +++ b/src/mswin/fg_window_mswin.c @@ -636,17 +636,11 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, } if( !sizeUse ) { - if( !window->IsMenu ) - { - w = CW_USEDEFAULT; - h = CW_USEDEFAULT; - } - else /* fail safe - Windows can make a window of size (0, 0) */ - w = h = 300; /* default window size */ + w = CW_USEDEFAULT; + h = CW_USEDEFAULT; } - -#if !defined(_WIN32_WCE) /* no decorations for windows CE */ - if( sizeUse ) +#if !defined(_WIN32_WCE) /* no decorations for windows CE, so nothing to do */ + else { RECT windowRect; /* @@ -742,8 +736,9 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, #if defined(_WIN32_WCE) ShowWindow( window->Window.Handle, SW_SHOW ); #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, iconic ? SW_SHOWMINIMIZED : SW_SHOWNORMAL ); } diff --git a/src/x11/fg_window_x11.c b/src/x11/fg_window_x11.c index 71814ac..f9e94a4 100644 --- a/src/x11/fg_window_x11.c +++ b/src/x11/fg_window_x11.c @@ -300,12 +300,6 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, } #endif - /* - * XXX Assume the new window is visible by default - * XXX Is this a safe assumption? - */ - window->State.Visible = GL_TRUE; - sizeHints.flags = 0; if ( positionUse ) sizeHints.flags |= USPosition; @@ -362,7 +356,11 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, fgRegisterDevices( fgDisplay.pDisplay.Display, &(window->Window.Handle) ); #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);