From: Diederick Niehorster Date: Sat, 20 Apr 2013 14:04:06 +0000 (+0000) Subject: strip out GLUT_DISPLAY_CALLBACK from worklist _before_ calling display callback.... X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;h=a857e58176328995447a10addf3ea74f54fe63ae;p=freeglut strip out GLUT_DISPLAY_CALLBACK from worklist _before_ calling display callback. Any postredisplay in the display callback will then be honored, but no unnecessary redisplay work will be called due to redisplays queued during resize, visibility and other such processing git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1617 7f0cb862-5218-0410-a997-914c9d46530a --- diff --git a/src/fg_main.c b/src/fg_main.c index fb3d9db..7190272 100644 --- a/src/fg_main.c +++ b/src/fg_main.c @@ -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 ); + } } }