strip out GLUT_DISPLAY_CALLBACK from worklist _before_ calling display callback....
authorDiederick Niehorster <dcnieho@gmail.com>
Sat, 20 Apr 2013 14:04:06 +0000 (14:04 +0000)
committerDiederick Niehorster <dcnieho@gmail.com>
Sat, 20 Apr 2013 14:04:06 +0000 (14:04 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1617 7f0cb862-5218-0410-a997-914c9d46530a

src/fg_main.c

index fb3d9db..7190272 100644 (file)
@@ -432,10 +432,17 @@ void fgPlatformProcessWork(SFG_Window *window)
         }
     }
 
-    if (workMask & GLUT_DISPLAY_WORK)
+    /* check window state's workmask as well as some of the above callbacks might have generated redisplay requests. We can deal with those right now instead of wait for the next mainloop iteration. */
+    if (workMask & GLUT_DISPLAY_WORK || window->State.WorkMask & GLUT_DISPLAY_WORK)
     {
         if( window->State.Visible )
+        {
+            /* Strip out display work from the work list */
+            /* NB: do this before the display callback is called as user might call postredisplay in his display callback */
+            window->State.WorkMask &= ~GLUT_DISPLAY_WORK;
+
             fghRedrawWindow ( window );
+        }
     }
 }