From: Diederick Niehorster Date: Thu, 4 Apr 2013 10:54:44 +0000 (+0000) Subject: instead of separate Pause and Resume CBs, we now have a AppStatus CB which passes... X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;h=75c76b69c97acea662e41c261dc90324d8906825;p=freeglut 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: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1586 7f0cb862-5218-0410-a997-914c9d46530a --- diff --git a/include/GL/freeglut_ext.h b/include/GL/freeglut_ext.h index 3826e46..5b8422d 100644 --- a/include/GL/freeglut_ext.h +++ b/include/GL/freeglut_ext.h @@ -250,8 +250,10 @@ FGAPI void FGAPIENTRY glutSetVertexAttribTexCoord2(GLint attrib); /* Mobile platforms lifecycle */ FGAPI void FGAPIENTRY glutInitContextFunc(void (* callback)()); -FGAPI void FGAPIENTRY glutPauseFunc(void (* callback)()); -FGAPI void FGAPIENTRY glutResumeFunc(void (* callback)()); +FGAPI void FGAPIENTRY glutAppStatusFunc(void (* callback)(int)); +/* 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 diff --git a/src/android/fg_main_android.c b/src/android/fg_main_android.c index ce3f585..4c862f5 100644 --- a/src/android/fg_main_android.c +++ b/src/android/fg_main_android.c @@ -437,7 +437,7 @@ void fgPlatformProcessSingleEvent ( void ) /* If we're not in RESUME state, Android paused us, so wait */ struct android_app* app = fgDisplay.pDisplay.app; if (app->destroyRequested != 1 && app->activityState != APP_CMD_RESUME) { - INVOKE_WCB(*window, Pause, ()); + INVOKE_WCB(*window, AppStatus, (GLUT_APPSTATUS_PAUSE)); int FOREVER = -1; 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)"); } - INVOKE_WCB(*window, Resume, ()); + INVOKE_WCB(*window, AppStatus, (GLUT_APPSTATUS_RESUME)); } } diff --git a/src/fg_callbacks.c b/src/fg_callbacks.c index c62d37c..7c82c81 100644 --- a/src/fg_callbacks.c +++ b/src/fg_callbacks.c @@ -145,8 +145,7 @@ IMPLEMENT_CALLBACK_FUNC(MultiButton); IMPLEMENT_CALLBACK_FUNC(MultiMotion); IMPLEMENT_CALLBACK_FUNC(MultiPassive); IMPLEMENT_CALLBACK_FUNC(InitContext); -IMPLEMENT_CALLBACK_FUNC(Pause); -IMPLEMENT_CALLBACK_FUNC(Resume); +IMPLEMENT_CALLBACK_FUNC(AppStatus); diff --git a/src/fg_ext.c b/src/fg_ext.c index 8432232..6835854 100644 --- a/src/fg_ext.c +++ b/src/fg_ext.c @@ -203,12 +203,11 @@ static GLUTproc fghGetGLUTProcAddress( const char* procName ) CHECK_NAME(glutInitContextProfile); CHECK_NAME(glutInitErrorFunc); CHECK_NAME(glutInitWarningFunc); - CHECK_NAME(glutInitContextFunc) - CHECK_NAME(glutPauseFunc) - CHECK_NAME(glutResumeFunc) - CHECK_NAME(glutSetVertexAttribCoord3) - CHECK_NAME(glutSetVertexAttribNormal) - CHECK_NAME(glutSetVertexAttribTexCoord2) + CHECK_NAME(glutInitContextFunc); + CHECK_NAME(glutAppStatusFunc); + CHECK_NAME(glutSetVertexAttribCoord3); + CHECK_NAME(glutSetVertexAttribNormal); + CHECK_NAME(glutSetVertexAttribTexCoord2); #undef CHECK_NAME return NULL; diff --git a/src/fg_internal.h b/src/fg_internal.h index 1b671c3..6974dd3 100644 --- a/src/fg_internal.h +++ b/src/fg_internal.h @@ -220,8 +220,7 @@ typedef void (* FGCBMultiMotion )( int, int, int ); typedef void (* FGCBMultiPassive )( int, int, int ); typedef void (* FGCBInitContext)(); -typedef void (* FGCBPause)(); -typedef void (* FGCBResume)(); +typedef void (* FGCBAppStatus)(int); /* The global callbacks type definitions */ typedef void (* FGCBIdle )( void ); @@ -602,8 +601,7 @@ enum /* Mobile platforms LifeCycle */ WCB_InitContext, - WCB_Pause, - WCB_Resume, + WCB_AppStatus, /* Presently ignored */ WCB_Select, diff --git a/src/freeglutdll.def.in b/src/freeglutdll.def.in index bb2c75e..988d7d3 100644 --- a/src/freeglutdll.def.in +++ b/src/freeglutdll.def.in @@ -159,8 +159,7 @@ EXPORTS glutMultiMotionFunc glutMultiPassiveFunc glutInitContextFunc - glutPauseFunc - glutResumeFunc + glutAppStatusFunc glutSetVertexAttribCoord3 glutSetVertexAttribNormal glutSetVertexAttribTexCoord2