Converted the "Callbacks" structure (with named members holding individual
authorRichard Rauch <rkr@olib.org>
Thu, 6 Nov 2003 22:09:35 +0000 (22:09 +0000)
committerRichard Rauch <rkr@olib.org>
Thu, 6 Nov 2003 22:09:35 +0000 (22:09 +0000)
commit5d724da03c1b5988304888c17c5eba8a40c0a529
treebc50b2c2298fdaf342a7f2996ff719882e60847e
parentd3f260238533f3e30cfa730f61f5726158618bde
Converted the "Callbacks" structure (with named members holding individual
callback pointers) to a "CallBacks" array in fgState.  (This is to allow
us to write a loop to clear all callbacks from windows when the window is
dead/dying.  Using this, we can safely assign NULL to each in a loop.)

Support includes two new macros, FETCH_WCB() and INVOKE_WCB().  See
freeglut_internal.h for more details there.

Some typedefs of function pointer types were altered to make them more
uniform (necessary for the macros).

All references to window-based callbacks in freeglut are updated to
use the new macros.

Old usages will cause compile-time errors.

As a side bonus, the new invocation macro sets the current window and
checks pointers so that these common steps can be uniformly done on
every window-based callback.  This makes it easier to do things right.
At the same time, the array notation (and now required associated casts)
make it harder to bypass the macros and abuse the function pointers,
in general.

After this commit, I will go through the code and clean up dangling issues
about formatting.  This commit is just a "it now works, let's checkpoint it"
type of affair.

git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@303 7f0cb862-5218-0410-a997-914c9d46530a
src/freeglut_callbacks.c
src/freeglut_init.c
src/freeglut_internal.h
src/freeglut_joystick.c
src/freeglut_main.c
src/freeglut_misc.c
src/freeglut_structure.c