added glutPositionFunc callback, now just need to implement so it does

something
For all callbacks now using function type definitions from
fg_internal.h.
Reorganized and cleaned up fg_callbacks.c so that there are no wrong
comments in there (timers are global, not per window) and so that all
global, per menu, and per window callbacks are grouped together


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1474 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
dcnieho 2012-11-23 06:40:06 +00:00
parent a99ea4e190
commit d1efa5eb48
6 changed files with 141 additions and 144 deletions

View File

@ -139,9 +139,10 @@ FGAPI void FGAPIENTRY glutLeaveFullScreen( void );
* Window-specific callback functions, see freeglut_callbacks.c * Window-specific callback functions, see freeglut_callbacks.c
*/ */
FGAPI void FGAPIENTRY glutMouseWheelFunc( void (* callback)( int, int, int, int ) ); FGAPI void FGAPIENTRY glutMouseWheelFunc( void (* callback)( int, int, int, int ) );
FGAPI void FGAPIENTRY glutPositionFunc( void (* callback)( int, int ) );
FGAPI void FGAPIENTRY glutCloseFunc( void (* callback)( void ) ); FGAPI void FGAPIENTRY glutCloseFunc( void (* callback)( void ) );
FGAPI void FGAPIENTRY glutWMCloseFunc( void (* callback)( void ) ); FGAPI void FGAPIENTRY glutWMCloseFunc( void (* callback)( void ) );
/* A. Donev: Also a destruction callback for menus */ /* And also a destruction callback for menus */
FGAPI void FGAPIENTRY glutMenuDestroyFunc( void (* callback)( void ) ); FGAPI void FGAPIENTRY glutMenuDestroyFunc( void (* callback)( void ) );
/* /*
@ -218,15 +219,13 @@ void glutJoystickGetCenter( int ident, float *axes );
/* /*
* Initialization functions, see freeglut_init.c * Initialization functions, see freeglut_init.c
*/ */
/* to get the typedef for va_list */
#include <stdarg.h>
FGAPI void FGAPIENTRY glutInitContextVersion( int majorVersion, int minorVersion ); FGAPI void FGAPIENTRY glutInitContextVersion( int majorVersion, int minorVersion );
FGAPI void FGAPIENTRY glutInitContextFlags( int flags ); FGAPI void FGAPIENTRY glutInitContextFlags( int flags );
FGAPI void FGAPIENTRY glutInitContextProfile( int profile ); FGAPI void FGAPIENTRY glutInitContextProfile( int profile );
FGAPI void FGAPIENTRY glutInitErrorFunc( void (* callback)( const char *fmt, va_list ap ) );
/* to get the typedef for va_list */ FGAPI void FGAPIENTRY glutInitWarningFunc( void (* callback)( const char *fmt, va_list ap ) );
#include <stdarg.h>
FGAPI void FGAPIENTRY glutInitErrorFunc( void (* vError)( const char *fmt, va_list ap ) );
FGAPI void FGAPIENTRY glutInitWarningFunc( void (* vWarning)( const char *fmt, va_list ap ) );
/* OpenGL >= 2.0 support */ /* OpenGL >= 2.0 support */
FGAPI void FGAPIENTRY glutSetVertexAttribCoord3(GLint attrib); FGAPI void FGAPIENTRY glutSetVertexAttribCoord3(GLint attrib);

View File

@ -30,71 +30,19 @@
/* -- INTERFACE FUNCTIONS -------------------------------------------------- */ /* -- INTERFACE FUNCTIONS -------------------------------------------------- */
/*
* All of the callbacks setting methods can be generalized to this:
*/
#define SET_CALLBACK(a) \
do \
{ \
if( fgStructure.CurrentWindow == NULL ) \
return; \
SET_WCB( ( *( fgStructure.CurrentWindow ) ), a, callback ); \
} while( 0 )
/* /*
* Sets the Display callback for the current window * Global callbacks.
*/ */
void FGAPIENTRY glutDisplayFunc( void (* callback)( void ) ) /* Sets the global idle callback */
{ void FGAPIENTRY glutIdleFunc( FGCBIdle callback )
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutDisplayFunc" );
if( !callback )
fgError( "Fatal error in program. NULL display callback not "
"permitted in GLUT 3.0+ or freeglut 2.0.1+" );
SET_CALLBACK( Display );
}
/*
* Sets the Reshape callback for the current window
*/
void FGAPIENTRY glutReshapeFunc( void (* callback)( int, int ) )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutReshapeFunc" );
SET_CALLBACK( Reshape );
}
/*
* Sets the Keyboard callback for the current window
*/
void FGAPIENTRY glutKeyboardFunc( void (* callback)
( unsigned char, int, int ) )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutKeyboardFunc" );
SET_CALLBACK( Keyboard );
}
/*
* Sets the Special callback for the current window
*/
void FGAPIENTRY glutSpecialFunc( void (* callback)( int, int, int ) )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSpecialFunc" );
SET_CALLBACK( Special );
}
/*
* Sets the global idle callback
*/
void FGAPIENTRY glutIdleFunc( void (* callback)( void ) )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutIdleFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutIdleFunc" );
fgState.IdleCallback = callback; fgState.IdleCallback = callback;
} }
/* /* Creates a timer and sets its callback */
* Sets the Timer callback for the current window void FGAPIENTRY glutTimerFunc( unsigned int timeOut, FGCBTimer callback, int timerID )
*/
void FGAPIENTRY glutTimerFunc( unsigned int timeOut, void (* callback)( int ),
int timerID )
{ {
SFG_Timer *timer, *node; SFG_Timer *timer, *node;
@ -124,6 +72,101 @@ void FGAPIENTRY glutTimerFunc( unsigned int timeOut, void (* callback)( int ),
fgListInsert( &fgState.Timers, &node->Node, &timer->Node ); fgListInsert( &fgState.Timers, &node->Node, &timer->Node );
} }
/* Deprecated version of glutMenuStatusFunc callback setting method */
void FGAPIENTRY glutMenuStateFunc( FGCBMenuState callback )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMenuStateFunc" );
fgState.MenuStateCallback = callback;
}
/* Sets the global menu status callback for the current window */
void FGAPIENTRY glutMenuStatusFunc( FGCBMenuStatus callback )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMenuStatusFunc" );
fgState.MenuStatusCallback = callback;
}
/*
* Menu specific callbacks.
*/
/* Callback upon menu destruction */
void FGAPIENTRY glutMenuDestroyFunc( FGCBDestroy callback )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMenuDestroyFunc" );
if( fgStructure.CurrentMenu )
fgStructure.CurrentMenu->Destroy = callback;
}
/*
* All of the window-specific callbacks setting methods can be generalized to this:
*/
#define SET_CALLBACK(a) \
do \
{ \
if( fgStructure.CurrentWindow == NULL ) \
return; \
SET_WCB( ( *( fgStructure.CurrentWindow ) ), a, callback ); \
} while( 0 )
/*
* Sets the Display callback for the current window
*/
void FGAPIENTRY glutDisplayFunc( FGCBDisplay callback )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutDisplayFunc" );
if( !callback )
fgError( "Fatal error in program. NULL display callback not "
"permitted in GLUT 3.0+ or freeglut 2.0.1+" );
SET_CALLBACK( Display );
}
/*
* Sets the Reshape callback for the current window
*/
void FGAPIENTRY glutReshapeFunc( FGCBReshape callback )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutReshapeFunc" );
SET_CALLBACK( Reshape );
}
/*
* Sets the Keyboard callback for the current window
*/
void FGAPIENTRY glutKeyboardFunc( FGCBKeyboard callback )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutKeyboardFunc" );
SET_CALLBACK( Keyboard );
}
/*
* Sets the keyboard key release callback for the current window
*/
void FGAPIENTRY glutKeyboardUpFunc( FGCBKeyboardUp callback )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutKeyboardUpFunc" );
SET_CALLBACK( KeyboardUp );
}
/*
* Sets the Special callback for the current window
*/
void FGAPIENTRY glutSpecialFunc( FGCBSpecial callback )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSpecialFunc" );
SET_CALLBACK( Special );
}
/*
* Sets the special key release callback for the current window
*/
void FGAPIENTRY glutSpecialUpFunc( FGCBSpecialUp callback )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSpecialUpFunc" );
SET_CALLBACK( SpecialUp );
}
/* /*
* Sets the Visibility callback for the current window. * Sets the Visibility callback for the current window.
*/ */
@ -139,7 +182,7 @@ static void fghVisibility( int status )
INVOKE_WCB( *( fgStructure.CurrentWindow ), Visibility, ( glut_status ) ); INVOKE_WCB( *( fgStructure.CurrentWindow ), Visibility, ( glut_status ) );
} }
void FGAPIENTRY glutVisibilityFunc( void (* callback)( int ) ) void FGAPIENTRY glutVisibilityFunc( FGCBVisibility callback )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutVisibilityFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutVisibilityFunc" );
SET_CALLBACK( Visibility ); SET_CALLBACK( Visibility );
@ -150,31 +193,10 @@ void FGAPIENTRY glutVisibilityFunc( void (* callback)( int ) )
glutWindowStatusFunc( NULL ); glutWindowStatusFunc( NULL );
} }
/*
* Sets the keyboard key release callback for the current window
*/
void FGAPIENTRY glutKeyboardUpFunc( void (* callback)
( unsigned char, int, int ) )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutKeyboardUpFunc" );
SET_CALLBACK( KeyboardUp );
}
/*
* Sets the special key release callback for the current window
*/
void FGAPIENTRY glutSpecialUpFunc( void (* callback)( int, int, int ) )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSpecialUpFunc" );
SET_CALLBACK( SpecialUp );
}
/* /*
* Sets the joystick callback and polling rate for the current window * Sets the joystick callback and polling rate for the current window
*/ */
void FGAPIENTRY glutJoystickFunc( void (* callback) void FGAPIENTRY glutJoystickFunc( FGCBJoystick callback, int pollInterval )
( unsigned int, int, int, int ),
int pollInterval )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutJoystickFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutJoystickFunc" );
fgInitialiseJoysticks (); fgInitialiseJoysticks ();
@ -201,7 +223,7 @@ void FGAPIENTRY glutJoystickFunc( void (* callback)
/* /*
* Sets the mouse callback for the current window * Sets the mouse callback for the current window
*/ */
void FGAPIENTRY glutMouseFunc( void (* callback)( int, int, int, int ) ) void FGAPIENTRY glutMouseFunc( FGCBMouse callback )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMouseFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMouseFunc" );
SET_CALLBACK( Mouse ); SET_CALLBACK( Mouse );
@ -210,7 +232,7 @@ void FGAPIENTRY glutMouseFunc( void (* callback)( int, int, int, int ) )
/* /*
* Sets the mouse wheel callback for the current window * Sets the mouse wheel callback for the current window
*/ */
void FGAPIENTRY glutMouseWheelFunc( void (* callback)( int, int, int, int ) ) void FGAPIENTRY glutMouseWheelFunc( FGCBMouseWheel callback )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMouseWheelFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMouseWheelFunc" );
SET_CALLBACK( MouseWheel ); SET_CALLBACK( MouseWheel );
@ -220,7 +242,7 @@ void FGAPIENTRY glutMouseWheelFunc( void (* callback)( int, int, int, int ) )
* Sets the mouse motion callback for the current window (one or more buttons * Sets the mouse motion callback for the current window (one or more buttons
* are pressed) * are pressed)
*/ */
void FGAPIENTRY glutMotionFunc( void (* callback)( int, int ) ) void FGAPIENTRY glutMotionFunc( FGCBMotion callback )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMotionFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMotionFunc" );
SET_CALLBACK( Motion ); SET_CALLBACK( Motion );
@ -230,7 +252,7 @@ void FGAPIENTRY glutMotionFunc( void (* callback)( int, int ) )
* Sets the passive mouse motion callback for the current window (no mouse * Sets the passive mouse motion callback for the current window (no mouse
* buttons are pressed) * buttons are pressed)
*/ */
void FGAPIENTRY glutPassiveMotionFunc( void (* callback)( int, int ) ) void FGAPIENTRY glutPassiveMotionFunc( FGCBPassive callback )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutPassiveMotionFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutPassiveMotionFunc" );
SET_CALLBACK( Passive ); SET_CALLBACK( Passive );
@ -239,7 +261,7 @@ void FGAPIENTRY glutPassiveMotionFunc( void (* callback)( int, int ) )
/* /*
* Window mouse entry/leave callback * Window mouse entry/leave callback
*/ */
void FGAPIENTRY glutEntryFunc( void (* callback)( int ) ) void FGAPIENTRY glutEntryFunc( FGCBEntry callback )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutEntryFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutEntryFunc" );
SET_CALLBACK( Entry ); SET_CALLBACK( Entry );
@ -248,48 +270,22 @@ void FGAPIENTRY glutEntryFunc( void (* callback)( int ) )
/* /*
* Window destruction callbacks * Window destruction callbacks
*/ */
void FGAPIENTRY glutCloseFunc( void (* callback)( void ) ) void FGAPIENTRY glutCloseFunc( FGCBDestroy callback )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCloseFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCloseFunc" );
SET_CALLBACK( Destroy ); SET_CALLBACK( Destroy );
} }
void FGAPIENTRY glutWMCloseFunc( void (* callback)( void ) ) void FGAPIENTRY glutWMCloseFunc( FGCBDestroy callback )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWMCloseFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWMCloseFunc" );
glutCloseFunc( callback ); glutCloseFunc( callback );
} }
/* A. Donev: Destruction callback for menus */
void FGAPIENTRY glutMenuDestroyFunc( void (* callback)( void ) )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMenuDestroyFunc" );
if( fgStructure.CurrentMenu )
fgStructure.CurrentMenu->Destroy = callback;
}
/*
* Deprecated version of glutMenuStatusFunc callback setting method
*/
void FGAPIENTRY glutMenuStateFunc( void (* callback)( int ) )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMenuStateFunc" );
fgState.MenuStateCallback = callback;
}
/*
* Sets the global menu status callback for the current window
*/
void FGAPIENTRY glutMenuStatusFunc( void (* callback)( int, int, int ) )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMenuStatusFunc" );
fgState.MenuStatusCallback = callback;
}
/* /*
* Sets the overlay display callback for the current window * Sets the overlay display callback for the current window
*/ */
void FGAPIENTRY glutOverlayDisplayFunc( void (* callback)( void ) ) void FGAPIENTRY glutOverlayDisplayFunc( FGCBOverlayDisplay callback )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutOverlayDisplayFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutOverlayDisplayFunc" );
SET_CALLBACK( OverlayDisplay ); SET_CALLBACK( OverlayDisplay );
@ -298,7 +294,7 @@ void FGAPIENTRY glutOverlayDisplayFunc( void (* callback)( void ) )
/* /*
* Sets the window status callback for the current window * Sets the window status callback for the current window
*/ */
void FGAPIENTRY glutWindowStatusFunc( void (* callback)( int ) ) void FGAPIENTRY glutWindowStatusFunc( FGCBWindowStatus callback )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWindowStatusFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWindowStatusFunc" );
SET_CALLBACK( WindowStatus ); SET_CALLBACK( WindowStatus );
@ -307,7 +303,7 @@ void FGAPIENTRY glutWindowStatusFunc( void (* callback)( int ) )
/* /*
* Sets the spaceball motion callback for the current window * Sets the spaceball motion callback for the current window
*/ */
void FGAPIENTRY glutSpaceballMotionFunc( void (* callback)( int, int, int ) ) void FGAPIENTRY glutSpaceballMotionFunc( FGCBSpaceMotion callback )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSpaceballMotionFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSpaceballMotionFunc" );
fgInitialiseSpaceball(); fgInitialiseSpaceball();
@ -318,7 +314,7 @@ void FGAPIENTRY glutSpaceballMotionFunc( void (* callback)( int, int, int ) )
/* /*
* Sets the spaceball rotate callback for the current window * Sets the spaceball rotate callback for the current window
*/ */
void FGAPIENTRY glutSpaceballRotateFunc( void (* callback)( int, int, int ) ) void FGAPIENTRY glutSpaceballRotateFunc( FGCBSpaceRotation callback )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSpaceballRotateFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSpaceballRotateFunc" );
fgInitialiseSpaceball(); fgInitialiseSpaceball();
@ -329,7 +325,7 @@ void FGAPIENTRY glutSpaceballRotateFunc( void (* callback)( int, int, int ) )
/* /*
* Sets the spaceball button callback for the current window * Sets the spaceball button callback for the current window
*/ */
void FGAPIENTRY glutSpaceballButtonFunc( void (* callback)( int, int ) ) void FGAPIENTRY glutSpaceballButtonFunc( FGCBSpaceButton callback )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSpaceballButtonFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSpaceballButtonFunc" );
fgInitialiseSpaceball(); fgInitialiseSpaceball();
@ -340,7 +336,7 @@ void FGAPIENTRY glutSpaceballButtonFunc( void (* callback)( int, int ) )
/* /*
* Sets the button box callback for the current window * Sets the button box callback for the current window
*/ */
void FGAPIENTRY glutButtonBoxFunc( void (* callback)( int, int ) ) void FGAPIENTRY glutButtonBoxFunc( FGCBButtonBox callback )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutButtonBoxFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutButtonBoxFunc" );
SET_CALLBACK( ButtonBox ); SET_CALLBACK( ButtonBox );
@ -349,7 +345,7 @@ void FGAPIENTRY glutButtonBoxFunc( void (* callback)( int, int ) )
/* /*
* Sets the dials box callback for the current window * Sets the dials box callback for the current window
*/ */
void FGAPIENTRY glutDialsFunc( void (* callback)( int, int ) ) void FGAPIENTRY glutDialsFunc( FGCBDials callback )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutDialsFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutDialsFunc" );
SET_CALLBACK( Dials ); SET_CALLBACK( Dials );
@ -358,7 +354,7 @@ void FGAPIENTRY glutDialsFunc( void (* callback)( int, int ) )
/* /*
* Sets the tablet motion callback for the current window * Sets the tablet motion callback for the current window
*/ */
void FGAPIENTRY glutTabletMotionFunc( void (* callback)( int, int ) ) void FGAPIENTRY glutTabletMotionFunc( FGCBTabletMotion callback )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutTabletMotionFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutTabletMotionFunc" );
SET_CALLBACK( TabletMotion ); SET_CALLBACK( TabletMotion );
@ -367,7 +363,7 @@ void FGAPIENTRY glutTabletMotionFunc( void (* callback)( int, int ) )
/* /*
* Sets the tablet buttons callback for the current window * Sets the tablet buttons callback for the current window
*/ */
void FGAPIENTRY glutTabletButtonFunc( void (* callback)( int, int, int, int ) ) void FGAPIENTRY glutTabletButtonFunc( FGCBTabletButton callback )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutTabletButtonFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutTabletButtonFunc" );
SET_CALLBACK( TabletButton ); SET_CALLBACK( TabletButton );
@ -376,7 +372,7 @@ void FGAPIENTRY glutTabletButtonFunc( void (* callback)( int, int, int, int ) )
/* /*
* Sets the multi-pointer entry callback for the current window * Sets the multi-pointer entry callback for the current window
*/ */
void FGAPIENTRY glutMultiEntryFunc( void (* callback)(int, int ) ) void FGAPIENTRY glutMultiEntryFunc( FGCBMultiEntry callback )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMultiEntryFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMultiEntryFunc" );
SET_CALLBACK( MultiEntry ); SET_CALLBACK( MultiEntry );
@ -385,7 +381,7 @@ void FGAPIENTRY glutMultiEntryFunc( void (* callback)(int, int ) )
/* /*
* Sets the multi-pointer button callback for the current window * Sets the multi-pointer button callback for the current window
*/ */
void FGAPIENTRY glutMultiButtonFunc( void (* callback)(int, int, int, int, int ) ) void FGAPIENTRY glutMultiButtonFunc( FGCBMultiButton callback )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMultiButtonFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMultiButtonFunc" );
SET_CALLBACK( MultiButton ); SET_CALLBACK( MultiButton );
@ -394,7 +390,7 @@ void FGAPIENTRY glutMultiButtonFunc( void (* callback)(int, int, int, int, int )
/* /*
* Sets the multi-pointer motion callback for the current window * Sets the multi-pointer motion callback for the current window
*/ */
void FGAPIENTRY glutMultiMotionFunc( void (* callback)(int, int, int ) ) void FGAPIENTRY glutMultiMotionFunc( FGCBMultiMotion callback )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMultiMotionFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMultiMotionFunc" );
SET_CALLBACK( MultiMotion ); SET_CALLBACK( MultiMotion );
@ -403,7 +399,7 @@ void FGAPIENTRY glutMultiMotionFunc( void (* callback)(int, int, int ) )
/* /*
* Sets the multi-pointer passive motion callback for the current window * Sets the multi-pointer passive motion callback for the current window
*/ */
void FGAPIENTRY glutMultiPassiveFunc( void (* callback)(int, int, int ) ) void FGAPIENTRY glutMultiPassiveFunc( FGCBMultiPassive callback )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMultiPassiveFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutMultiPassiveFunc" );
SET_CALLBACK( MultiPassive ); SET_CALLBACK( MultiPassive );
@ -412,7 +408,7 @@ void FGAPIENTRY glutMultiPassiveFunc( void (* callback)(int, int, int ) )
/* /*
* Sets the context reload callback for the current window * Sets the context reload callback for the current window
*/ */
void FGAPIENTRY glutInitContextFunc( void (* callback)() ) void FGAPIENTRY glutInitContextFunc( FGCBInitContext callback )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutInitContextFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutInitContextFunc" );
SET_CALLBACK( InitContext ); SET_CALLBACK( InitContext );
@ -421,7 +417,7 @@ void FGAPIENTRY glutInitContextFunc( void (* callback)() )
/* /*
* Sets the pause callback for the current window * Sets the pause callback for the current window
*/ */
void FGAPIENTRY glutPauseFunc( void (* callback)() ) void FGAPIENTRY glutPauseFunc( FGCBPause callback )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutPauseFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutPauseFunc" );
SET_CALLBACK( Pause ); SET_CALLBACK( Pause );
@ -430,7 +426,7 @@ void FGAPIENTRY glutPauseFunc( void (* callback)() )
/* /*
* Sets the resume callback for the current window * Sets the resume callback for the current window
*/ */
void FGAPIENTRY glutResumeFunc( void (* callback)() ) void FGAPIENTRY glutResumeFunc( FGCBResume callback )
{ {
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutResumeFunc" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutResumeFunc" );
SET_CALLBACK( Resume ); SET_CALLBACK( Resume );

View File

@ -668,19 +668,19 @@ void FGAPIENTRY glutInitContextProfile( int profile )
/* /*
* Sets the user error handler (note the use of va_list for the args to the fmt) * Sets the user error handler (note the use of va_list for the args to the fmt)
*/ */
void FGAPIENTRY glutInitErrorFunc( void (* vfgError) ( const char *fmt, va_list ap ) ) void FGAPIENTRY glutInitErrorFunc( FGError callback )
{ {
/* This allows user programs to handle freeglut errors */ /* This allows user programs to handle freeglut errors */
fgState.ErrorFunc = vfgError; fgState.ErrorFunc = callback;
} }
/* /*
* Sets the user warning handler (note the use of va_list for the args to the fmt) * Sets the user warning handler (note the use of va_list for the args to the fmt)
*/ */
void FGAPIENTRY glutInitWarningFunc( void (* vfgWarning) ( const char *fmt, va_list ap ) ) void FGAPIENTRY glutInitWarningFunc( FGWarning callback )
{ {
/* This allows user programs to handle freeglut warnings */ /* This allows user programs to handle freeglut warnings */
fgState.WarningFunc = vfgWarning; fgState.WarningFunc = callback;
} }
/*** END OF FILE ***/ /*** END OF FILE ***/

View File

@ -191,9 +191,12 @@
/* Freeglut callbacks type definitions */ /* Freeglut callbacks type definitions */
typedef void (* FGCBDisplay )( void ); typedef void (* FGCBDisplay )( void );
typedef void (* FGCBReshape )( int, int ); typedef void (* FGCBReshape )( int, int );
typedef void (* FGCBPosition )( int, int );
typedef void (* FGCBVisibility )( int ); typedef void (* FGCBVisibility )( int );
typedef void (* FGCBKeyboard )( unsigned char, int, int ); typedef void (* FGCBKeyboard )( unsigned char, int, int );
typedef void (* FGCBKeyboardUp )( unsigned char, int, int );
typedef void (* FGCBSpecial )( int, int, int ); typedef void (* FGCBSpecial )( int, int, int );
typedef void (* FGCBSpecialUp )( int, int, int );
typedef void (* FGCBMouse )( int, int, int, int ); typedef void (* FGCBMouse )( int, int, int, int );
typedef void (* FGCBMouseWheel )( int, int, int, int ); typedef void (* FGCBMouseWheel )( int, int, int, int );
typedef void (* FGCBMotion )( int, int ); typedef void (* FGCBMotion )( int, int );
@ -202,8 +205,6 @@ typedef void (* FGCBEntry )( int );
typedef void (* FGCBWindowStatus )( int ); typedef void (* FGCBWindowStatus )( int );
typedef void (* FGCBSelect )( int, int, int ); typedef void (* FGCBSelect )( int, int, int );
typedef void (* FGCBJoystick )( unsigned int, int, int, int ); typedef void (* FGCBJoystick )( unsigned int, int, int, int );
typedef void (* FGCBKeyboardUp )( unsigned char, int, int );
typedef void (* FGCBSpecialUp )( int, int, int );
typedef void (* FGCBOverlayDisplay)( void ); typedef void (* FGCBOverlayDisplay)( void );
typedef void (* FGCBSpaceMotion )( int, int, int ); typedef void (* FGCBSpaceMotion )( int, int, int );
typedef void (* FGCBSpaceRotation )( int, int, int ); typedef void (* FGCBSpaceRotation )( int, int, int );
@ -212,7 +213,7 @@ typedef void (* FGCBDials )( int, int );
typedef void (* FGCBButtonBox )( int, int ); typedef void (* FGCBButtonBox )( int, int );
typedef void (* FGCBTabletMotion )( int, int ); typedef void (* FGCBTabletMotion )( int, int );
typedef void (* FGCBTabletButton )( int, int, int, int ); typedef void (* FGCBTabletButton )( int, int, int, int );
typedef void (* FGCBDestroy )( void ); typedef void (* FGCBDestroy )( void ); /* Used for both window and menu destroy callbacks */
typedef void (* FGCBMultiEntry )( int, int ); typedef void (* FGCBMultiEntry )( int, int );
typedef void (* FGCBMultiButton )( int, int, int, int, int ); typedef void (* FGCBMultiButton )( int, int, int, int, int );

View File

@ -791,7 +791,7 @@ void fghCalculateMenuBoxSize( void )
/* /*
* Creates a new menu object, adding it to the freeglut structure * Creates a new menu object, adding it to the freeglut structure
*/ */
int FGAPIENTRY glutCreateMenu( void(* callback)( int ) ) int FGAPIENTRY glutCreateMenu( FGCBMenu callback )
{ {
/* The menu object creation code resides in freeglut_structure.c */ /* The menu object creation code resides in freeglut_structure.c */
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCreateMenu" ); FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCreateMenu" );

View File

@ -55,6 +55,7 @@ EXPORTS
glutKeyboardFunc glutKeyboardFunc
glutSpecialFunc glutSpecialFunc
glutReshapeFunc glutReshapeFunc
glutPositionFunc
glutVisibilityFunc glutVisibilityFunc
glutDisplayFunc glutDisplayFunc
glutMouseFunc glutMouseFunc