Fixed a bug for UNIX_X11 where window reshape events were causing freeglut

to mark the window as *needing* a reshape (which during general display
callback handling would result in effectively a glutReshapeWindow()).

The code is now system-dependant.  It should be abstracted to a function,
but is presently copied in two places.  Sorry.

Also, inverted the order of the associated if()/else check (in both
WIN32 and UNIX_X11 branches) since the former "else" part was a one-line
callback invocation.

This fixes two seemingly unrelated bugs that I was seeing in UNIX_X11.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@374 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
rkrolib 2003-12-02 15:03:48 +00:00
parent d45a86a088
commit 819e8645b6

View File

@ -126,15 +126,15 @@ static void fghReshapeWindowByHandle ( SFG_WindowHandleType handle,
);
}
#endif
if( !( FETCH_WCB( *window, Reshape ) ) )
if( FETCH_WCB( *window, Reshape ) )
INVOKE_WCB( *window, Reshape, ( width, height ) );
else
{
fgSetWindow( window );
glViewport( 0, 0, width, height );
}
else
INVOKE_WCB( *window, Reshape, ( width, height ) );
#endif
/*
* Force a window redraw. In Windows at least this is only a partial
@ -552,9 +552,19 @@ void FGAPIENTRY glutMainLoopEvent( void )
case CreateNotify:
case ConfigureNotify:
GETWINDOW( xconfigure );
window->State.NeedToResize = GL_TRUE ;
window->State.Width = event.xconfigure.width ;
window->State.Height = event.xconfigure.height;
{
int width = event.xconfigure.width;
int height = event.xconfigure.height;
GETWINDOW( xconfigure );
if( FETCH_WCB( *window, Reshape ) )
INVOKE_WCB( *window, Reshape, ( width, height ) );
else
{
fgSetWindow( window );
glViewport( 0, 0, width, height );
}
}
break;
case DestroyNotify: