redisplay is now also on the work list instead of handled separately
[freeglut] / src / android / fg_main_android.c
index ce3f585..1fa41d6 100644 (file)
@@ -437,7 +437,7 @@ void fgPlatformProcessSingleEvent ( void )
   /* If we're not in RESUME state, Android paused us, so wait */\r
   struct android_app* app = fgDisplay.pDisplay.app;\r
   if (app->destroyRequested != 1 && app->activityState != APP_CMD_RESUME) {\r
-      INVOKE_WCB(*window, Pause, ());\r
+      INVOKE_WCB(*window, AppStatus, (GLUT_APPSTATUS_PAUSE));\r
 \r
     int FOREVER = -1;\r
     while (app->destroyRequested != 1 && (app->activityState != APP_CMD_RESUME)) {\r
@@ -472,7 +472,7 @@ void fgPlatformProcessSingleEvent ( void )
           fgWarning("Resuming application, but no callback to reload context resources (glutInitContextFunc)");\r
     }\r
 \r
-    INVOKE_WCB(*window, Resume, ());\r
+    INVOKE_WCB(*window, AppStatus, (GLUT_APPSTATUS_RESUME));\r
   }\r
 }\r
 \r
@@ -495,6 +495,8 @@ void fgPlatformProcessWork(SFG_Window *window)
     /* Now clear it so that any callback generated by the actions below can set work again */\r
     window->State.WorkMask = 0;\r
 \r
+    if (workMask&~GLUT_DISPLAY_WORK)    /* Display work is the common case, skip all the below at once */\r
+    {\r
     /* This is before the first display callback: call a few callbacks to inform user of window size, position, etc\r
      * we know this is before the first display callback of a window as for all windows GLUT_INIT_WORK is set when\r
      * they are opened, and work is done before displaying in the mainloop.\r
@@ -562,5 +564,15 @@ void fgPlatformProcessWork(SFG_Window *window)
             break;\r
         }\r
     }\r
+    }\r
+\r
+    if (workMask & GLUT_DISPLAY_WORK)\r
+    {\r
+        if( window->State.Visible )\r
+            fghRedrawWindow ( window );\r
+\r
+        /* Strip out display work that might have ended up on work list now as some of the above genereates callbacks */\r
+        window->State.WorkMask &= ~GLUT_DISPLAY_WORK;\r
+    }\r
 }\r
 \r