From a99ea4e190e480b19945035c1b9dbdb5fef77f7e Mon Sep 17 00:00:00 2001 From: dcnieho Date: Fri, 23 Nov 2012 06:13:31 +0000 Subject: [PATCH] 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 --- freeglut/web-src/docs/api.php | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/freeglut/web-src/docs/api.php b/freeglut/web-src/docs/api.php index 3b65981..75ba821 100644 --- a/freeglut/web-src/docs/api.php +++ b/freeglut/web-src/docs/api.php @@ -888,19 +888,26 @@ about to be destroyed.

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

Changes From GLUT