PDA

View Full Version : Further to John's Message



Rob Fletcher
05-01-2002, 01:08 AM
Hi all,

The nasty behaviour on closing "any" window
managed by GLUT can now be avoided.

The new codebase allows you to register a
callback on a per window basis.

e.g.

win1=glutCreateWindow(...);
glutWMCloseFunc(win1closer);
...
win2=glutCreateWindow(...);
glutWMCloseFunc(notallowed);
...
win3=glutCreateWindow(...);
glutWMCloseFunc(notallowed);

Thus, if when windows win2/win3 are closed via the window manager buttons or menu, then
the function "notallowed" will be called, which can simply do nothing!

When win1 is clolsed, "win1closer" will be
called.

If you do nothing, then a default close handler is registered for each window, and this does exactly as glut did before (i.e. a
quick and dirty and nasty "exit(0)" etc).

So, with the new code you can avoid this and take back control of your application should the user try to shut down via the window buttons or menus.

See:

http://www-users.york.ac.uk/~rpf1/glut.html

email me for details etc ...

Letme know if you use the code and have problems. I will then try to fix anything which comes up!

Cheers all,

Rob.