PDA

View Full Version : Disable the 'X' (close) button



Cybernet_X
05-24-2002, 10:25 PM
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!?

jmathies
05-25-2002, 11:01 AM
Originally posted by Cybernet_X:
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!?


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

Rob Fletcher
05-26-2002, 11:35 PM
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.

Cybernet_X
05-27-2002, 03:38 AM
Hummmm, I'm using Kylix on Linux...

Rob Fletcher
05-28-2002, 02:19 AM
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.

Somay
05-30-2002, 03:25 AM
Originally posted by jmathies:

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



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

John Nagle
05-30-2002, 06:25 PM
Originally posted by Rob Fletcher:


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.


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.

Rob Fletcher
05-30-2002, 10:18 PM
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.