Disable the 'X' (close) button

How can I disable the X button of a window created with GLUT???

I use the glutCreateWindow(Title) and then I want to disable the possiblity to close this window… how I can do this!?

Originally posted by Cybernet_X:
[b]How can I disable the X button of a window created with GLUT???

I use the glutCreateWindow(Title) and then I want to disable the possiblity to close this window… how I can do this!?[/b]

You will have to modify the glut event
loop within that library to allow you to
do this, or add win32 specific code to
your app to manually change the window
style (removing the x completely.)

or try a different library that supports a
window close event that you can approve / dissaprove. Like [Cpw](http://"http://www.mathies.com/cpw/\) .

regards,
Jim

The code to do this is posted at:
http://www-users.york.ac.uk/~rpf1/glut.html

You will need to take the source code there,
replace the modules in your own glut source code (which you should download, if you only have the .dll or .a file).

You should then build your own .dll or .a library …

I have done this OK with the Borland compiler, no experience of MS VC++ etc (yet!)

Fine on Unix too!

If you build a working .dll (and .lib file)
usinf a MS compiler, it would be useful to make it available to others for testing (no re-distribution, as this is NOT allowed by the terms for the original GLUT library!)

Regards,

Rob.

Hummmm, I’m using Kylix on Linux…

Ok, Linux … then get the sources and build your own library (including my patched files!).

But then, not knowing about Kylix, I may have this all horribly wrong!

Your mileage may vary.

Rob.

Originally posted by jmathies:
[b]
You will have to modify the glut event
loop within that library to allow you to
do this, or add win32 specific code to
your app to manually change the window
style (removing the x completely.)

or try a different library that supports a
window close event that you can approve / dissaprove. Like [Cpw](http://"http://www.mathies.com/cpw/\) .

regards,
Jim
[/b]

how do I add win32 specific code to glut program? I posted a new thread about this @ http://www.opengl.org/discussion_boards/ubb/Forum10/HTML/000070.html

Originally posted by Rob Fletcher:
[b]

If you build a working .dll (and .lib file)
usinf a MS compiler, it would be useful to make it available to others for testing (no re-distribution, as this is NOT allowed by the terms for the original GLUT library!)

Regards,

Rob.[/b]

You could ask Mark Kilgard for permission. He’s at “mjk@nvidia.com”.

GLUT is useful enough that it needs to be maintained now and then. There’s FreeGLUT, on SourceForge, if the licensing on the original GLUT is too restrictive.

Clearly this is a worthwhile change. There are three subtopics in this forum asking about how to capture window close events.

OK,

I will email Mark now and see if he would be interested in doing something …

There are two possible routes … either a fully patched up GLUT (but we will have to go the same way for further updates/patches),

or …

A better way to extend the event processing.

In the “X” world an auxillary event processor can be bound into the event loop to catch those events NOT processed by GLUT.

i.e. instead of catching e.g. ClientMessage
the “user supplied” auxillary function could catch it, and then the user (or "
community"!) could do as they wish.

Perhaps Nate would see if this could be extended to the winblows version too! (It’s
there in the X version already …

see the “default:” entry in the glut_event.c
for X windows version.

I do think the mainloop() issue MUST be resolved as people really need to do their own thing as well … and more especially if they need another system which has an event loop! The ideal of course, is a way to register event loops (note plural) into a cascading “meta-event-loop”. (Try programming with video, audio and graphics event loops at the same time! It’s hell!).

What the default is for the above of course needs discussion … I expect we should look for full backwards compatibility … and in this sense we should NOT really change the current GLUT structures (which I did to bind inthe callback per window!). So, an auxillary window structure is needed to complement the existing defined structure. (Been thinking this way since posting the code anyway … so I should be able to sort this).

oh oh, my network is bust … well, my mail system is down. Will send this, and email Mark with ideas/code etc later.

Cheers all,

Rob.