Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 8 of 8

Thread: Disable the 'X' (close) button

  1. #1
    Junior Member Newbie
    Join Date
    May 2002
    Location
    Xi'an, ShaanShi, China
    Posts
    9

    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!?

  2. #2
    Junior Member Regular Contributor
    Join Date
    Feb 2002
    Posts
    133

    Re: Disable the 'X' (close) button

    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 .

    regards,
    Jim
    --
    Jim Mathies http://www.mathies.com/

    \"The best way to predict the future is to invent it."

  3. #3
    Junior Member Regular Contributor
    Join Date
    May 2002
    Location
    York, UK
    Posts
    128

    Re: Disable the 'X' (close) button

    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.

  4. #4
    Junior Member Newbie
    Join Date
    May 2002
    Location
    Xi'an, ShaanShi, China
    Posts
    9

    Re: Disable the 'X' (close) button

    Hummmm, I'm using Kylix on Linux...

  5. #5
    Junior Member Regular Contributor
    Join Date
    May 2002
    Location
    York, UK
    Posts
    128

    Re: Disable the 'X' (close) button

    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.

  6. #6
    Junior Member Newbie
    Join Date
    May 2002
    Posts
    3

    Re: Disable the 'X' (close) button

    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 .

    regards,
    Jim

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

  7. #7

    Re: Disable the 'X' (close) button

    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.

  8. #8
    Junior Member Regular Contributor
    Join Date
    May 2002
    Location
    York, UK
    Posts
    128

    Re: Disable the 'X' (close) button

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •