Hrm. I misunderstood the purpose of {window->State.Width} and
{...Height}. Those are *not* records of the old values, but rather of the *desired* *new* values, hence it was inappropriate to use them in ConfigureNotify X11 event handling. Doing so introduced some new problems. So, I created OldHeight and OldWidth in the window State structure, and *those* do what I require. I also stripped out the obsolete comment about getting extra/bogus reshape events. (Though I maintain that an application should be robust against them, freeglut should no longer generate them if the window has not changed size since last reported.) git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@378 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
60cc2c79ce
commit
03cf899635
@ -353,6 +353,8 @@ struct tagSFG_WindowState
|
|||||||
{
|
{
|
||||||
int Width; /* Window's width in pixels */
|
int Width; /* Window's width in pixels */
|
||||||
int Height; /* The same about the height */
|
int Height; /* The same about the height */
|
||||||
|
int OldWidth; /* Window width from before a resize */
|
||||||
|
int OldHeight; /* " height " " " " */
|
||||||
|
|
||||||
GLboolean Redisplay; /* Do we have to redisplay? */
|
GLboolean Redisplay; /* Do we have to redisplay? */
|
||||||
GLboolean Visible; /* Is the window visible now */
|
GLboolean Visible; /* Is the window visible now */
|
||||||
|
@ -559,10 +559,6 @@ void FGAPIENTRY glutMainLoopEvent( void )
|
|||||||
* (in freeglut only) will not get an initial reshape event,
|
* (in freeglut only) will not get an initial reshape event,
|
||||||
* which can break things.
|
* which can break things.
|
||||||
*
|
*
|
||||||
* XXX NOTE that it is possible that you will more than one Reshape
|
|
||||||
* XXX event for your top-level window, but something like this
|
|
||||||
* XXX appears to be required for compatbility.
|
|
||||||
*
|
|
||||||
* GLUT presumably does this because it generally tries to treat
|
* GLUT presumably does this because it generally tries to treat
|
||||||
* sub-windows the same as windows.
|
* sub-windows the same as windows.
|
||||||
*/
|
*/
|
||||||
@ -573,11 +569,11 @@ void FGAPIENTRY glutMainLoopEvent( void )
|
|||||||
int width = event.xconfigure.width;
|
int width = event.xconfigure.width;
|
||||||
int height = event.xconfigure.height;
|
int height = event.xconfigure.height;
|
||||||
|
|
||||||
if( ( width != window->State.Width ) ||
|
if( ( width != window->State.OldWidth ) ||
|
||||||
( height != window->State.Height ) )
|
( height != window->State.OldHeight ) )
|
||||||
{
|
{
|
||||||
window->State.Width = width;
|
window->State.OldWidth = width;
|
||||||
window->State.Height = height;
|
window->State.OldHeight = height;
|
||||||
if( FETCH_WCB( *window, Reshape ) )
|
if( FETCH_WCB( *window, Reshape ) )
|
||||||
INVOKE_WCB( *window, Reshape, ( width, height ) );
|
INVOKE_WCB( *window, Reshape, ( width, height ) );
|
||||||
else
|
else
|
||||||
|
@ -610,6 +610,7 @@ int FGAPIENTRY glutCreateSubWindow( int parentID, int x, int y, int w, int h )
|
|||||||
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, GL_FALSE );
|
window = fgCreateWindow( parent, "", x, y, w, h, GL_FALSE, GL_FALSE );
|
||||||
|
window->State.OldHeight = window->State.OldWidth = -1;
|
||||||
return window->ID;
|
return window->ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user