+
+ /* 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, ());
+
+ int FOREVER = -1;
+ while (app->destroyRequested != 1 && (app->activityState != APP_CMD_RESUME)) {
+ if ((ident=ALooper_pollOnce(FOREVER, NULL, &events, (void**)&source)) >= 0) {
+ /* Process this event. */
+ if (source != NULL) {
+ source->process(source->app, source);
+ }
+ }
+ }
+ /* Coming back from a pause: */
+ /* - Recreate window context and surface */
+ /* - Call user-defined hook to restore resources (textures...) */
+ /* - Exit pause looop */
+ if (app->destroyRequested != 1) {
+ /* Android is full-screen only, simplified call.. */
+ /* Ideally we'd have a fgPlatformReopenWindow() */
+ /* If we're hidden by a non-fullscreen or translucent activity,
+ we'll be paused but not stopped, and keep the current
+ surface; in which case fgPlatformOpenWindow will no-op. */
+ fgPlatformOpenWindow(window, "", GL_FALSE, 0, 0, GL_FALSE, 0, 0, GL_FALSE, GL_FALSE);
+
+ if (!FETCH_WCB(*window, InitContext))
+ fgWarning("Resuming application, but no callback to reload context resources (glutInitContextFunc)");
+ }
+
+ INVOKE_WCB(*window, Resume, ());
+ }