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
This commit is contained in:
rkrolib 2003-11-25 04:57:10 +00:00
parent db9108dfeb
commit 96ee3c4798
3 changed files with 12 additions and 68 deletions

View File

@ -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 );

View File

@ -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,14 +1678,6 @@ 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,
@ -1734,7 +1685,6 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
);
fgState.Modifiers = 0xffffffff;
}
}
break;
case WM_CAPTURECHANGED:

View File

@ -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, ( ) );