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".