From 819e8645b622d49eb11a1eb19bb581adca2575b9 Mon Sep 17 00:00:00 2001 From: rkrolib Date: Tue, 2 Dec 2003 15:03:48 +0000 Subject: [PATCH] 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 --- freeglut/freeglut/src/freeglut_main.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/freeglut/freeglut/src/freeglut_main.c b/freeglut/freeglut/src/freeglut_main.c index 55e033a..bbcb1ab 100644 --- a/freeglut/freeglut/src/freeglut_main.c +++ b/freeglut/freeglut/src/freeglut_main.c @@ -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: