[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]

The Intuition event loop used in the example is very simple.  The example
first sets up a custom screen, opens a window on it, then waits for
Intuition to send messages about user input with the following event loop:

    winsignal = 1L << window1->UserPort->mp_SigBit;  /* window signal */
    signalmask = winsignal;   /* example only waits for window events */

    while( !done )  {
        signals = Wait(signalmask);
        if (signals & winsignal)
            done = handleIDCMP(window1);

Intuition sends messages about user activity to a special port known as
the IDCMP.  Each window can have its own IDCMP (in the code above the
IDCMP is window1->UserPort).  To wait for event messages to arrive at the
IDCMP port, the example code calls the Exec Wait() function.  It then
processes and replies to any event messages that it gets in a subroutine
named handleIDCMP().  For this example, the only event Intuition will
report is the close window event.  When the example detects this event, it
closes the window, closes the screen, closes the Intuition library and
exits.  Event loops similar to this one are used in Intuition examples
throughout this book.  For more information about IDCMP and user input,
see the chapters on "Intuition Windows" and "Intuition Input and Output".

[Back to Amiga Developer Docs]