Fixing bug report #1052151 from October 2004.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@715 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
c609d36203
commit
9c2a742925
@ -429,8 +429,9 @@ int FGAPIENTRY glutEnterGameMode( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
fgStructure.GameModeWindow = fgCreateWindow(
|
fgStructure.GameModeWindow = fgCreateWindow(
|
||||||
NULL, "FREEGLUT", 0, 0,
|
NULL, "FREEGLUT", GL_TRUE, 0, 0,
|
||||||
fgState.GameModeSize.X, fgState.GameModeSize.Y, GL_TRUE, GL_FALSE
|
GL_TRUE, fgState.GameModeSize.X, fgState.GameModeSize.Y,
|
||||||
|
GL_TRUE, GL_FALSE
|
||||||
);
|
);
|
||||||
|
|
||||||
fgStructure.GameModeWindow->State.Width = fgState.GameModeSize.X;
|
fgStructure.GameModeWindow->State.Width = fgState.GameModeSize.X;
|
||||||
|
@ -803,12 +803,14 @@ 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 positionUse, int x, int y,
|
||||||
|
GLboolean sizeUse, int w, int h,
|
||||||
GLboolean gameMode, GLboolean isMenu );
|
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,
|
GLboolean positionUse, int x, int y,
|
||||||
GLboolean isSubWindow );
|
GLboolean sizeUse, int w, int h,
|
||||||
|
GLboolean gameMode, GLboolean isSubWindow );
|
||||||
void fgCloseWindow( SFG_Window* window );
|
void fgCloseWindow( SFG_Window* window );
|
||||||
void fgAddToWindowDestroyList ( SFG_Window* window );
|
void fgAddToWindowDestroyList ( SFG_Window* window );
|
||||||
void fgCloseWindows ();
|
void fgCloseWindows ();
|
||||||
|
@ -1609,8 +1609,15 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
|
|||||||
}
|
}
|
||||||
|
|
||||||
window->State.NeedToResize = GL_TRUE;
|
window->State.NeedToResize = GL_TRUE;
|
||||||
window->State.Width = fgState.Size.X;
|
if( ( window->State.Width < 0 ) || ( window->State.Height < 0 ) )
|
||||||
window->State.Height = fgState.Size.Y;
|
{
|
||||||
|
SFG_Window *current_window = fgStructure.CurrentWindow;
|
||||||
|
|
||||||
|
fgSetWindow( window );
|
||||||
|
window->State.Width = glutGet( GLUT_WINDOW_WIDTH );
|
||||||
|
window->State.Height = glutGet( GLUT_WINDOW_HEIGHT );
|
||||||
|
fgSetWindow( current_window );
|
||||||
|
}
|
||||||
|
|
||||||
ReleaseDC( window->Window.Handle, window->Window.Device );
|
ReleaseDC( window->Window.Handle, window->Window.Device );
|
||||||
|
|
||||||
|
@ -159,10 +159,14 @@ int FGAPIENTRY glutGet( GLenum eWhat )
|
|||||||
case GLUT_SCREEN_HEIGHT: return fgDisplay.ScreenHeight ;
|
case GLUT_SCREEN_HEIGHT: return fgDisplay.ScreenHeight ;
|
||||||
case GLUT_SCREEN_WIDTH_MM: return fgDisplay.ScreenWidthMM ;
|
case GLUT_SCREEN_WIDTH_MM: return fgDisplay.ScreenWidthMM ;
|
||||||
case GLUT_SCREEN_HEIGHT_MM: return fgDisplay.ScreenHeightMM;
|
case GLUT_SCREEN_HEIGHT_MM: return fgDisplay.ScreenHeightMM;
|
||||||
case GLUT_INIT_WINDOW_X: return fgState.Position.X ;
|
case GLUT_INIT_WINDOW_X: return fgState.Position.Use ?
|
||||||
case GLUT_INIT_WINDOW_Y: return fgState.Position.Y ;
|
fgState.Position.X : -1 ;
|
||||||
case GLUT_INIT_WINDOW_WIDTH: return fgState.Size.X ;
|
case GLUT_INIT_WINDOW_Y: return fgState.Position.Use ?
|
||||||
case GLUT_INIT_WINDOW_HEIGHT: return fgState.Size.Y ;
|
fgState.Position.Y : -1 ;
|
||||||
|
case GLUT_INIT_WINDOW_WIDTH: return fgState.Size.Use ?
|
||||||
|
fgState.Size.X : -1 ;
|
||||||
|
case GLUT_INIT_WINDOW_HEIGHT: return fgState.Size.Use ?
|
||||||
|
fgState.Size.Y : -1 ;
|
||||||
case GLUT_INIT_DISPLAY_MODE: return fgState.DisplayMode ;
|
case GLUT_INIT_DISPLAY_MODE: return fgState.DisplayMode ;
|
||||||
|
|
||||||
#if TARGET_HOST_POSIX_X11
|
#if TARGET_HOST_POSIX_X11
|
||||||
|
@ -65,7 +65,8 @@ static void fghClearCallBacks( 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 positionUse, int x, int y,
|
||||||
|
GLboolean sizeUse, int w, int h,
|
||||||
GLboolean gameMode, GLboolean isMenu )
|
GLboolean gameMode, GLboolean isMenu )
|
||||||
{
|
{
|
||||||
/* Have the window object created */
|
/* Have the window object created */
|
||||||
@ -98,7 +99,7 @@ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title,
|
|||||||
* Open the window now. The fgOpenWindow() function is system
|
* Open the window now. The fgOpenWindow() function is system
|
||||||
* dependant, and resides in freeglut_window.c. Uses fgState.
|
* dependant, and resides in freeglut_window.c. Uses fgState.
|
||||||
*/
|
*/
|
||||||
fgOpenWindow( window, title, x, y, w, h, gameMode,
|
fgOpenWindow( window, title, positionUse, x, y, sizeUse, w, h, gameMode,
|
||||||
(GLboolean)(parent ? GL_TRUE : GL_FALSE) );
|
(GLboolean)(parent ? GL_TRUE : GL_FALSE) );
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
@ -119,7 +120,8 @@ SFG_Menu* fgCreateMenu( FGCBMenu menuCallback )
|
|||||||
|
|
||||||
/* Create a window for the menu to reside in. */
|
/* Create a window for the menu to reside in. */
|
||||||
|
|
||||||
fgCreateWindow( NULL, "freeglut menu", x, y, w, h, GL_FALSE, GL_TRUE );
|
fgCreateWindow( NULL, "freeglut menu", GL_TRUE, x, y, GL_TRUE, w, h,
|
||||||
|
GL_FALSE, GL_TRUE );
|
||||||
menu->Window = fgStructure.CurrentWindow;
|
menu->Window = fgStructure.CurrentWindow;
|
||||||
glutDisplayFunc( fgDisplayMenu );
|
glutDisplayFunc( fgDisplayMenu );
|
||||||
|
|
||||||
|
@ -400,7 +400,8 @@ void fgSetWindow ( SFG_Window *window )
|
|||||||
* to the freeglut structure. OpenGL context is created here.
|
* to the freeglut structure. OpenGL context is created here.
|
||||||
*/
|
*/
|
||||||
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 positionUse, int x, int y,
|
||||||
|
GLboolean sizeUse, int w, int h,
|
||||||
GLboolean gameMode, GLboolean isSubWindow )
|
GLboolean gameMode, GLboolean isSubWindow )
|
||||||
{
|
{
|
||||||
#if TARGET_HOST_POSIX_X11
|
#if TARGET_HOST_POSIX_X11
|
||||||
@ -477,6 +478,11 @@ void fgOpenWindow( SFG_Window* window, const char* title,
|
|||||||
mask |= CWOverrideRedirect;
|
mask |= CWOverrideRedirect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( ! positionUse )
|
||||||
|
x = y = -1; /* default window position */
|
||||||
|
if( ! sizeUse )
|
||||||
|
w = h = 300; /* default window size */
|
||||||
|
|
||||||
window->Window.Handle = XCreateWindow(
|
window->Window.Handle = XCreateWindow(
|
||||||
fgDisplay.Display,
|
fgDisplay.Display,
|
||||||
window->Parent == NULL ? fgDisplay.RootWindow :
|
window->Parent == NULL ? fgDisplay.RootWindow :
|
||||||
@ -549,9 +555,9 @@ void fgOpenWindow( SFG_Window* window, const char* title,
|
|||||||
window->State.Visible = GL_TRUE;
|
window->State.Visible = GL_TRUE;
|
||||||
|
|
||||||
sizeHints.flags = 0;
|
sizeHints.flags = 0;
|
||||||
if ( fgState.Position.Use )
|
if ( positionUse )
|
||||||
sizeHints.flags |= USPosition;
|
sizeHints.flags |= USPosition;
|
||||||
if ( fgState.Size.Use )
|
if ( sizeUse )
|
||||||
sizeHints.flags |= USSize;
|
sizeHints.flags |= USSize;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -622,6 +628,8 @@ void fgOpenWindow( SFG_Window* window, const char* title,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
int worig = w, horig = h;
|
||||||
|
|
||||||
#if !defined(_WIN32_WCE)
|
#if !defined(_WIN32_WCE)
|
||||||
if ( ( ! isSubWindow ) && ( ! window->IsMenu ) )
|
if ( ( ! isSubWindow ) && ( ! window->IsMenu ) )
|
||||||
{
|
{
|
||||||
@ -636,16 +644,28 @@ void fgOpenWindow( SFG_Window* window, const char* title,
|
|||||||
}
|
}
|
||||||
#endif /* defined(_WIN32_WCE) */
|
#endif /* defined(_WIN32_WCE) */
|
||||||
|
|
||||||
if( ! fgState.Position.Use )
|
if( ! positionUse )
|
||||||
{
|
{
|
||||||
x = CW_USEDEFAULT;
|
x = CW_USEDEFAULT;
|
||||||
y = CW_USEDEFAULT;
|
y = CW_USEDEFAULT;
|
||||||
}
|
}
|
||||||
if( ! fgState.Size.Use )
|
/* setting State.Width/Height to call resize callback later */
|
||||||
|
if( ! sizeUse )
|
||||||
|
{
|
||||||
|
if( ! window->IsMenu )
|
||||||
{
|
{
|
||||||
w = CW_USEDEFAULT;
|
w = CW_USEDEFAULT;
|
||||||
h = CW_USEDEFAULT;
|
h = CW_USEDEFAULT;
|
||||||
}
|
}
|
||||||
|
else /* fail safe - Windows can make a window of size (0, 0) */
|
||||||
|
w = h = 300; /* default window size */
|
||||||
|
window->State.Width = window->State.Height = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
window->State.Width = worig;
|
||||||
|
window->State.Height = horig;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* There's a small difference between creating the top, child and
|
* There's a small difference between creating the top, child and
|
||||||
@ -790,9 +810,10 @@ int FGAPIENTRY glutCreateWindow( const char* title )
|
|||||||
*/
|
*/
|
||||||
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCreateWindow" );
|
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCreateWindow" );
|
||||||
|
|
||||||
return fgCreateWindow( NULL, title, fgState.Position.X, fgState.Position.Y,
|
return fgCreateWindow( NULL, title, fgState.Position.Use,
|
||||||
fgState.Size.X, fgState.Size.Y, GL_FALSE,
|
fgState.Position.X, fgState.Position.Y,
|
||||||
GL_FALSE )->ID;
|
fgState.Size.Use, fgState.Size.X, fgState.Size.Y,
|
||||||
|
GL_FALSE, GL_FALSE )->ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -833,7 +854,7 @@ int FGAPIENTRY glutCreateSubWindow( int parentID, int x, int y, int w, int h )
|
|||||||
h = -h ;
|
h = -h ;
|
||||||
}
|
}
|
||||||
|
|
||||||
window = fgCreateWindow( parent, "", x, y, w, h, GL_FALSE, GL_FALSE );
|
window = fgCreateWindow( parent, "", GL_TRUE, x, y, GL_TRUE, w, h, GL_FALSE, GL_FALSE );
|
||||||
ret = window->ID;
|
ret = window->ID;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Reference in New Issue
Block a user