Re: Exiting application

Glynn Clements <[email protected]>
Newsgroups gmane.comp.lang.haskell.hopengl
Message-ID <[email protected]>
David Waern wrote:

> How are you supposed to handle the event of a user who closes the hopengl
> window? I see no way to detect this with the API. The main loop of hopengl
> just keeps running.

OpenGL doesn't deal with window management; that's handled by
whichever UI toolkit you are using. GLUT responds to window deletion
by either calling exit (X11):

      case ClientMessage:
        if (event.xclient.data.l[0] == __glutWMDeleteWindow)
          exit(0);
        break;

or PostQuitMessage() (Win32):

  case WM_CLOSE:
    PostQuitMessage(0);

If you want more control, you'll need to use something other than
GLUT, e.g. GTK+HS or wxHaskell.

-- 
Glynn Clements <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.