looked into purpose of glutWMCloseFunc, it was to prevent the window on

which the callback is called from being closed. The ultimate aim was to
prevent GLUT from exiting. We do this in a different way, which is added
to the docs in the discussion of glutCloseFunc


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1473 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
dcnieho 2012-11-23 06:13:31 +00:00
parent 6724c68a10
commit a99ea4e190

View File

@ -888,19 +888,26 @@ about to be destroyed.
<p> <p>
The <tt>glutCloseFunc</tt> function specifies the function The <tt>glutCloseFunc</tt> function specifies the function
that <i>freeglut</i> will call when a window is about to be closed, that <i>freeglut</i> will call to notify the application that a window
either because it is requested using <tt>glutDestroyWindow</tt>, is about to be closed, either because it is requested using
because the user clicked on the "x" in the window header <tt>glutDestroyWindow</tt>, because the user clicked on the "x" in the
(for top-level windows only), or due to a pending closure of a window header (for top-level windows only), or due to a pending closure
subwindow's parent window. In the first case, the closure callback of a subwindow's parent window. In the first case, the closure callback
is not invoked from the <tt>glutDestroyWindow</tt> call, but at a is not invoked from the <tt>glutDestroyWindow</tt> call, but at a
later time point. later time point.<br />
<i>Freeglut</i> sets the <i>current window</i> to the window <i>Freeglut</i> sets the <i>current window</i> to the window
which is about to be closed when the callback is invoked. which is about to be closed when the callback is invoked. The window can
thus be retrieved in the callback using <tt>glutGetWindow</tt>.<br />
Please note that other further developments of <i>GLUT</i> provide a Please note that other further developments of <i>GLUT</i> provide a
<tt>glutWMCloseFunc</tt>. For compatibility, <i>FreeGLUT</i> also <tt>glutWMCloseFunc</tt>. For compatibility, <i>FreeGLUT</i> also
provides this function. It is however an alias to provides this function. It is however an alias to
<tt>glutCloseFunc</tt>. <tt>glutCloseFunc</tt>. Users looking to prevent <i>FreeGLUT</i> from
exiting when a window is closed, as was made possible with
<tt>glutWMCloseFunc</tt> by that callback's designer should look into
using glutSetOption to set <tt>GLUT_ACTION_ON_WINDOW_CLOSE</tt> to
<tt>GLUT_ACTION_GLUTMAINLOOP_RETURNS</tt> or
<tt>GLUT_ACTION_CONTINUE_EXECUTION</tt>. This will prevent the
application from exiting when a window is closed.
<p><b>Changes From GLUT</b></p> <p><b>Changes From GLUT</b></p>