From 96ee3c4798a713adb9aea2cb1b8c207fad9fb05e Mon Sep 17 00:00:00 2001 From: rkrolib Date: Tue, 25 Nov 2003 04:57:10 +0000 Subject: [PATCH] More work from John (sorry for procrastinating): * We forgot to bump our version number in freeglut_internal.h It is now at 2.0.2 (actually, I think that 2.1.0 might be a better choice), which is presumably going to be our next formal release. 2.0.1 is incorrectly identified as 2.0.0 in the header. * A typo in a comment has been corrected ("than"/"that"). * Numerous "manual" checks for callbacks are omitted now, since INVOKE_WCB() does this for us. These were holdovers from the pre-INVOKE_WCB() days. There may be some very subtle changes in freeglut behavior, since freeglut used to test the callbacks a little earlier in some cases and may have skipped some minor things (like changes to the current window) in some special cases, otherwise. It is not believed that any documented behavior is broken, and it is unlikely---not to say impossible---that any extant applications will detect the change. It is even possible that there is no external behavioral change in freeglut. This also significantly simplifies some sections of code that used to have conditional execution. "Unconditional code is simpler code" as one of the comments used to say. * Lots of XXX commentary is now removed. Some of it was obsoleted by other changes, some by changes from John. git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@363 7f0cb862-5218-0410-a997-914c9d46530a --- freeglut/freeglut/src/freeglut_internal.h | 4 +- freeglut/freeglut/src/freeglut_main.c | 70 ++++------------------ freeglut/freeglut/src/freeglut_structure.c | 6 -- 3 files changed, 12 insertions(+), 68 deletions(-) diff --git a/freeglut/freeglut/src/freeglut_internal.h b/freeglut/freeglut/src/freeglut_internal.h index ff08ae6..b511d0d 100644 --- a/freeglut/freeglut/src/freeglut_internal.h +++ b/freeglut/freeglut/src/freeglut_internal.h @@ -31,7 +31,7 @@ /* XXX Update these for each release! */ #define VERSION_MAJOR 2 #define VERSION_MINOR 0 -#define VERSION_PATCH 0 +#define VERSION_PATCH 2 /* * Freeglut is meant to be available under all Unix/X11 and Win32 platforms. @@ -771,7 +771,7 @@ SFG_Window* fgWindowByHandle( SFG_WindowHandleType hWindow ); SFG_Window* fgWindowByID( int windowID ); /* - * Looks up a menu given its ID. This is easier that fgWindowByXXX + * Looks up a menu given its ID. This is easier than fgWindowByXXX * as all menus are placed in a single doubly linked list... */ SFG_Menu* fgMenuByID( int menuID ); diff --git a/freeglut/freeglut/src/freeglut_main.c b/freeglut/freeglut/src/freeglut_main.c index 6413363..17cf1ed 100644 --- a/freeglut/freeglut/src/freeglut_main.c +++ b/freeglut/freeglut/src/freeglut_main.c @@ -83,18 +83,6 @@ static void fghReshapeWindowByHandle ( SFG_WindowHandleType handle, XResizeWindow( fgDisplay.Display, window->Window.Handle, width, height ); XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ - /* - * XXX REALLY shouldn't be done. GLUT docs state that this - * XXX isn't even processed immediately, but rather waits - * XXX for return to the mainloop. "This allows multiple - * XXX glutReshapeWindow, glutPositionWindow, and glutFullScreen - * XXX requests to the same window to be coalesced." (This is - * XXX having some deleterious effect on a sample program of mine.) - * XXX Not only does GLUT not flush at this point, GLUT doesn't even - * XXX *do* the reshape at this point! We should probably rip this - * XXX out and do what GLUT promises. It would be more efficient, and - * XXX might be more compatible. - */ #elif TARGET_HOST_WIN32 @@ -168,25 +156,10 @@ static void fghReshapeWindowByHandle ( SFG_WindowHandleType handle, static void fghRedrawWindowByHandle ( SFG_WindowHandleType handle ) { SFG_Window* window = fgWindowByHandle( handle ); - freeglut_return_if_fail( window != NULL ); + freeglut_return_if_fail( window ); + + window->State.Redisplay = GL_FALSE; - /* - * XXX Other than clearing the Redisplay flag or not, - * XXX we may as well rely on the INVOK_WCB() doing this - * XXX pointer-check. - * XXX - * XXX If we do not invoke the display because the pointer - * XXX is not defined (should never happen, really), then - * XXX we may enter an infinite busy-loop trying to update - * XXX the window. Similarly, if we skip because the window - * XXX is not visible. However, if the window becomes visible - * XXX at a later time, the window should get its callback - * XXX invoked. I would recommend removing the first check, - * XXX and making the second check only affect whether the - * XXX callback is invoked---but always clear the flag, if - * XXX the {window} pointer is defined. - */ - freeglut_return_if_fail( FETCH_WCB( *window, Display ) ); freeglut_return_if_fail( window->State.Visible ); if( window->State.NeedToResize ) @@ -205,7 +178,6 @@ static void fghRedrawWindowByHandle ( SFG_WindowHandleType handle ) fgSetWindow ( current_window ); } - window->State.Redisplay = GL_FALSE; INVOKE_WCB( *window, Display, ( ) ); } @@ -215,17 +187,7 @@ static void fghRedrawWindowByHandle ( SFG_WindowHandleType handle ) static void fghcbDisplayWindow( SFG_Window *window, SFG_Enumerator *enumerator ) { - /* - * XXX Do we need/want to check the callback pointer here? - * XXX INVOKE_WCB() will check for us. Arguably, the - * XXX Redisplay status flag should be cleared regardless - * XXX of any concern but that {window} is a valid pointer - * XXX (which this function is assuming anyway). - * XXX Especially since old GLUT wouldn't even enter its main - * XXX loop if you didn't have a display callback defined... - */ - if( ( FETCH_WCB( *window, Display ) ) && - window->State.Redisplay && + if( window->State.Redisplay && window->State.Visible ) { if( window->State.NeedToResize ) @@ -851,9 +813,6 @@ void FGAPIENTRY glutMainLoopEvent( void ) ! FETCH_WCB( *window, MouseWheel ) ) break; - /* - * XXX Why don't we use {window}? Other code here does... - */ fgState.Modifiers = fgGetXModifiers( &event ); /* @@ -1719,21 +1678,12 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, if( fgState.IgnoreKeyRepeat && (lParam & KF_REPEAT) ) break; - /* - * XXX INVOKE_WCB() takes care of the callback-pointer check. - * XXX We could just uncoditionally find/trash the Modifiers - * XXX and get rid of the "if( ... ) {" and "}". Unconditinal - * XXX code is simpler code. (^& - */ - if( FETCH_WCB( *window, Keyboard ) ) - { - fgState.Modifiers = fgGetWin32Modifiers( ); - INVOKE_WCB( *window, Keyboard, - ( (char)wParam, - window->State.MouseX, window->State.MouseY ) - ); - fgState.Modifiers = 0xffffffff; - } + fgState.Modifiers = fgGetWin32Modifiers( ); + INVOKE_WCB( *window, Keyboard, + ( (char)wParam, + window->State.MouseX, window->State.MouseY ) + ); + fgState.Modifiers = 0xffffffff; } break; diff --git a/freeglut/freeglut/src/freeglut_structure.c b/freeglut/freeglut/src/freeglut_structure.c index 3a7be97..bae5611 100644 --- a/freeglut/freeglut/src/freeglut_structure.c +++ b/freeglut/freeglut/src/freeglut_structure.c @@ -282,12 +282,6 @@ void fgDestroyWindow( SFG_Window* window, GLboolean needToClose ) while( subWindow = ( SFG_Window * )window->Children.First ) fgDestroyWindow( subWindow, needToClose ); - /* - * XXX Since INVOKE_WCB() tests the function pointer, why not make - * XXX this unconditional? Overhead is close to nil, and it would - * XXX clarify the code by omitting a conditional test. - */ - if( FETCH_WCB( *window, Destroy ) ) { SFG_Window *activeWindow = fgStructure.Window ; INVOKE_WCB( *window, Destroy, ( ) );