I have implemented quit a bit of window closure stuff into "freeglut".  You can find them summarized in "freeglut_ext.h".  There are two functions to define a window closure callback:

FGAPI void    FGAPIENTRY glutCloseFunc( void (* callback)( void ) );
FGAPI void    FGAPIENTRY glutWMCloseFunc( void (* callback)( void ) );

The two functions do the same thing, but apparently two people made two different GLUT hacks and we used the names from both of them.  There is a function to set a "freeglut" option:

FGAPI void    FGAPIENTRY glutSetOption ( GLenum option_flag, int value ) ;

and there are some related constants:

GLUT_ACTION_ON_WINDOW_CLOSE - defined what "freeglut" will do when the user closes a window from the operating system.  (This is a serious issue in Windows.)

GLUT_ACTION_EXIT                 - the program stops immediately (GLUT's behaviour)
GLUT_ACTION_GLUTMAINLOOP_RETURNS - the "glutMainLoop" call returns control to the calling function
GLUT_ACTION_CONTINUE_EXECUTION   - the window closes and "freeglut" continues execution

Check it out and if it needs improving please let me know.

John F. Fay
john.fay@eglin.af.mil




-----Original Message-----
From: John Nagle [mailto:nagle@animats.com]
Sent: Tuesday, December 24, 2002 6:28 PM
To: freeglut-developer@lists.sourceforge.net
Subject: [Freeglut-developer] Re: Window close callback


    How did that issue eventually get resolved?

    I originally started the proposal for a window close
callback about a year ago, because it was needed to make
multi-window support in GLOW work right.

    One of the authors of GLOW came up with a fix to
GLUT, but couldn't get it in.

    The general idea was that the old exit-on-close
behavior would be provided by making the default
window close callback do an exit.  If the user
provided a window close callback, and didn't exit
from within it, the GLUT main loop would eventually
return after the last window was closed.  New flags
and modes were thus unnecessary.

    (On an related note, there's a discussion on
Slashdot today about widget toolkits for OpenGL.
That issue is heating up again.)

                                John Nagle
                                Animats



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Freeglut-developer mailing list
Freeglut-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freeglut-developer