X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_main.c;h=95efa1834a225088df29e7c2cb566f67173f8252;hb=e914664550e34587f4b10d3fe52c61fbe6d61771;hp=4936528b92c2f0c70b6268f865358e367b7edbb9;hpb=7b835f24f622aa3232182ab8b35485c60b9b7e76;p=freeglut diff --git a/src/freeglut_main.c b/src/freeglut_main.c index 4936528..95efa18 100644 --- a/src/freeglut_main.c +++ b/src/freeglut_main.c @@ -191,6 +191,21 @@ static void fghcbDisplayWindow( SFG_Window *window, if( window->State.Redisplay && window->State.Visible ) { + /* + * XXX Resizing should *not* depend upon whether there + * XXX is a pending redisplay flag, as far as I can tell. + * XXX + * XXX Note, too, that the {NeedToResize} flag is a little + * XXX fuzzy in its meaning, since for WIN32, this also + * XXX means "we need to tell the application that the window has + * XXX changed size", while in X11, it only means "we need + * XXX to ask the window system to resize the window. + * XXX Splitting the flag's meaning might be desirable, but + * XXX that could complicate the code more. (On X11, the + * XXX user callback is called as soon as the event is + * XXX discovered, but resizing the window is postponed + * XXX until after other events.) + */ if( window->State.NeedToResize ) { SFG_Window *current_window = fgStructure.Window; @@ -544,10 +559,6 @@ void FGAPIENTRY glutMainLoopEvent( void ) * (in freeglut only) will not get an initial reshape event, * 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 * sub-windows the same as windows. */ @@ -558,13 +569,19 @@ void FGAPIENTRY glutMainLoopEvent( void ) int width = event.xconfigure.width; int height = event.xconfigure.height; - GETWINDOW( xconfigure ); - if( FETCH_WCB( *window, Reshape ) ) - INVOKE_WCB( *window, Reshape, ( width, height ) ); - else + if( ( width != window->State.OldWidth ) || + ( height != window->State.OldHeight ) ) { - fgSetWindow( window ); - glViewport( 0, 0, width, height ); + window->State.OldWidth = width; + window->State.OldHeight = height; + if( FETCH_WCB( *window, Reshape ) ) + INVOKE_WCB( *window, Reshape, ( width, height ) ); + else + { + fgSetWindow( window ); + glViewport( 0, 0, width, height ); + } + glutPostRedisplay( ); } } break;