[Contents] [index] [Help] [Retrace] [browse <] [Browse >]

This method asks an active gadget to handle an input event.  After
Intuition gets an OK to make this gadget object active (see the
gm_goactive method above), intuition starts sending input events to the
gadget.  Intuition sends them in the form of a GM_HANDLEINPUT message.
This method uses the same custom message structure as GM_GOACTIVE (see the
gpinput structure above).

The information in the gpinput structure is the same for gm_handleinput as
it is for gm_goactive.  the only difference is that the gm_handleinput
message's gpi_ievent can never be null.  it always points to an inputevent
structure.

The gadget has to examine the incoming InputEvents to see how its state
may have changed.  For example,  a string gadget processes key presses,
inserting them into the gadgets string.  When the string changes, the
gadget has to update its visual state to reflect that change.  Another
example is the prop gadget.  If the user picks up the prop gadget's knob,
the prop gadget has to track the mouse to process changes to the gadget's
internal values.  It does this by processing IECLASS_RAWMOUSE events.

If the GM_HANDLEINPUT method needs to do some rendering, it must call
obtaingirport() on the gm_handleinput message's gpi_ginfo to get a pointer
to a rastport.  to relinquish this rastport, the gm_handleinput method
must call releasegirport().  the gm_handleinput method has to allocate and
release this RastPort, it cannot be cached in the gm_goactive method.

The return value from GM_HANDLEINPUT informs Intuition if the gadget wants
to remain active.  The return values for the GM_HANDLEINPUT are similar to
gm_goactive.  the gadget tells intuition that it wants to remain active by
returning GMR_MEACTIVE.  A gadget tells Intuition it wants to become
inactive by returning one of the "go inactive" return values:

GMR_NOREUSE     Tells Intuition to throw away the gpinput.gpi_ievent
                InputEvent.

GMR_REUSE       Tells Intuition to reprocess the gpinput.gpi_ievent
                InputEvent after deactivating the gadget.

GMR_NEXTACTIVE  Tells Intuition to throw away the gpinput.gpi_ievent
                InputEvent and activate the next gflg_tabcycle gadget.

GMR_PREVACTIVE  Tells Intuition to throw away the gpinput.gpi_ievent
                InputEvent and activate the previous gflg_tabcycle gadget.

GMR_NOREUSE tells Intuition that the gadget does not want to be active and
should throw away the InputEvent that triggered the GM_HANDLEINPUT message
(or the gm_goactive message).  for example, an active prop gadget returns
GMR_NOREUSE when the user lets go of the left mouse button (thus letting
go of the prop gadget's knob).

A gadget can also return GMR_REUSE, which tells Intuition to reuse the
InputEvent.  For example, if the user clicks outside of an active string
gadget, that string gadget returns GMR_REUSE so Intuition can process that
mouse click, which could be over another gadget.  Another case where a
string gadget returns GMR_REUSE is when the user pushes the right mouse
button (the menu button).  The string gadget becomes inactive and the menu
button InputEvent gets reused by Intuition so it can pop up the menu bar.

The other two possible return values, GMR_NEXTACTIVE and GMR_PREVACTIVE
were added to the OS for Release 2.04.  These tell Intuition that a gadget
no longer wants to be active and that the GM_HANDLEINPUT message
InputEvent should be discarded.  Intuition then looks for the next
non-disabled (GMR_NEXTACTIVE) or previous (GMR_PREVACTIVE) gadget that has
its gflg_tabcycle flag set in its gadget.activation field (see the
gadgetclass ga_tabcycle attribute below), and attempts to activate it.

For both gm_goactive and gm_handleinput, the gadget can bitwise or any of
these "go inactive" return values with GMR_VERIFY.  The GMR_VERIFY flag
tells Intuition to send a idcmp_gadgetup intuimessage to the gadget's
window. If the gadget uses GMR_VERIFY, it has to supply a value for the
intuimessage's code field.  it does this by passing a value in the
gpinput's gpi_termination field.  this field points to a long word, the
lower 16-bits of which Intuition copies into the Code field.  The upper
16-bits are for future enhancements, so clear these bits.