Function Set-Window-Close-Callback

Part of:

package glfw
( set-window-close-callback < cbfun > )
Parameters
cbfun
Pointer to a callback function that will be called when a user requests that the window should be
closed, typically by clicking the window close icon (e.g. the cross in the upper right corner of a
window under Microsoft Windows). The function should have the following C language
prototype:
int GLFWCALL functionname( void );
Where functionname is the name of the callback function. The return value of the callback
function indicates wether or not the window close action should continue. If the function returns
GL_TRUE, the window will be closed. If the function returns GL_FALSE, the window will not
be closed.
If cbfun is NULL, any previously selected callback function will be deselected.

If you declare your callback as returning gl:boolean, you can use t and nil as return types.

Description
The function selects which function to be called upon a window close event.
A window has to be opened for this function to have any effect.

Notes
Window close events are recorded continuously, but only reported when glfwPollEvents,
glfwWaitEvents or glfwSwapBuffers is called.
The OpenGL™ context is still valid when this function is called.
Note that the window close callback function is not called when glfwCloseWindow is called, but only
when the close request comes from the window manager.
Do not call glfwCloseWindow from a window close callback function. Close the window by returning
GL_TRUE from the function.