instead of separate Pause and Resume CBs, we now have a AppStatus CB which passes flags to indicate which state was entered. more extensible

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1586 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
dcnieho 2013-04-04 10:54:44 +00:00
parent 753f2f1163
commit a66dc9389e
6 changed files with 15 additions and 18 deletions

View File

@ -250,8 +250,10 @@ FGAPI void FGAPIENTRY glutSetVertexAttribTexCoord2(GLint attrib);
/* Mobile platforms lifecycle */ /* Mobile platforms lifecycle */
FGAPI void FGAPIENTRY glutInitContextFunc(void (* callback)()); FGAPI void FGAPIENTRY glutInitContextFunc(void (* callback)());
FGAPI void FGAPIENTRY glutPauseFunc(void (* callback)()); FGAPI void FGAPIENTRY glutAppStatusFunc(void (* callback)(int));
FGAPI void FGAPIENTRY glutResumeFunc(void (* callback)()); /* state flags that can be passed to callback set by glutAppStatusFunc */
#define GLUT_APPSTATUS_PAUSE 0x0001
#define GLUT_APPSTATUS_RESUME 0x0002
/* /*
* GLUT API macro definitions -- the display mode definitions * GLUT API macro definitions -- the display mode definitions

View File

@ -437,7 +437,7 @@ void fgPlatformProcessSingleEvent ( void )
/* If we're not in RESUME state, Android paused us, so wait */ /* If we're not in RESUME state, Android paused us, so wait */
struct android_app* app = fgDisplay.pDisplay.app; struct android_app* app = fgDisplay.pDisplay.app;
if (app->destroyRequested != 1 && app->activityState != APP_CMD_RESUME) { if (app->destroyRequested != 1 && app->activityState != APP_CMD_RESUME) {
INVOKE_WCB(*window, Pause, ()); INVOKE_WCB(*window, AppStatus, (GLUT_APPSTATUS_PAUSE));
int FOREVER = -1; int FOREVER = -1;
while (app->destroyRequested != 1 && (app->activityState != APP_CMD_RESUME)) { while (app->destroyRequested != 1 && (app->activityState != APP_CMD_RESUME)) {
@ -472,7 +472,7 @@ void fgPlatformProcessSingleEvent ( void )
fgWarning("Resuming application, but no callback to reload context resources (glutInitContextFunc)"); fgWarning("Resuming application, but no callback to reload context resources (glutInitContextFunc)");
} }
INVOKE_WCB(*window, Resume, ()); INVOKE_WCB(*window, AppStatus, (GLUT_APPSTATUS_RESUME));
} }
} }

View File

@ -145,8 +145,7 @@ IMPLEMENT_CALLBACK_FUNC(MultiButton);
IMPLEMENT_CALLBACK_FUNC(MultiMotion); IMPLEMENT_CALLBACK_FUNC(MultiMotion);
IMPLEMENT_CALLBACK_FUNC(MultiPassive); IMPLEMENT_CALLBACK_FUNC(MultiPassive);
IMPLEMENT_CALLBACK_FUNC(InitContext); IMPLEMENT_CALLBACK_FUNC(InitContext);
IMPLEMENT_CALLBACK_FUNC(Pause); IMPLEMENT_CALLBACK_FUNC(AppStatus);
IMPLEMENT_CALLBACK_FUNC(Resume);

View File

@ -203,12 +203,11 @@ static GLUTproc fghGetGLUTProcAddress( const char* procName )
CHECK_NAME(glutInitContextProfile); CHECK_NAME(glutInitContextProfile);
CHECK_NAME(glutInitErrorFunc); CHECK_NAME(glutInitErrorFunc);
CHECK_NAME(glutInitWarningFunc); CHECK_NAME(glutInitWarningFunc);
CHECK_NAME(glutInitContextFunc) CHECK_NAME(glutInitContextFunc);
CHECK_NAME(glutPauseFunc) CHECK_NAME(glutAppStatusFunc);
CHECK_NAME(glutResumeFunc) CHECK_NAME(glutSetVertexAttribCoord3);
CHECK_NAME(glutSetVertexAttribCoord3) CHECK_NAME(glutSetVertexAttribNormal);
CHECK_NAME(glutSetVertexAttribNormal) CHECK_NAME(glutSetVertexAttribTexCoord2);
CHECK_NAME(glutSetVertexAttribTexCoord2)
#undef CHECK_NAME #undef CHECK_NAME
return NULL; return NULL;

View File

@ -220,8 +220,7 @@ typedef void (* FGCBMultiMotion )( int, int, int );
typedef void (* FGCBMultiPassive )( int, int, int ); typedef void (* FGCBMultiPassive )( int, int, int );
typedef void (* FGCBInitContext)(); typedef void (* FGCBInitContext)();
typedef void (* FGCBPause)(); typedef void (* FGCBAppStatus)(int);
typedef void (* FGCBResume)();
/* The global callbacks type definitions */ /* The global callbacks type definitions */
typedef void (* FGCBIdle )( void ); typedef void (* FGCBIdle )( void );
@ -602,8 +601,7 @@ enum
/* Mobile platforms LifeCycle */ /* Mobile platforms LifeCycle */
WCB_InitContext, WCB_InitContext,
WCB_Pause, WCB_AppStatus,
WCB_Resume,
/* Presently ignored */ /* Presently ignored */
WCB_Select, WCB_Select,

View File

@ -159,8 +159,7 @@ EXPORTS
glutMultiMotionFunc glutMultiMotionFunc
glutMultiPassiveFunc glutMultiPassiveFunc
glutInitContextFunc glutInitContextFunc
glutPauseFunc glutAppStatusFunc
glutResumeFunc
glutSetVertexAttribCoord3 glutSetVertexAttribCoord3
glutSetVertexAttribNormal glutSetVertexAttribNormal
glutSetVertexAttribTexCoord2 glutSetVertexAttribTexCoord2