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

Normally, after a commodity processes a hot key input event, it needs to
eliminate that input event.  Other commodities may need to replace an
input event with a different one.  The translate cxobject can be used for
these purposes.

    translateCxObj = CxObj  *CxTranslate(struct InputEvent *newinputevent);

The macro cxtranslate() creates a new translate cxobject.  cxtranslate()'s
only argument is a pointer to a chain of one or more inputevent structures.

When a translate cxobject receives a cxmessage, it eliminates the
CxMessage and its corresponding input event from the system.  The
translator introduces a new input event, which Commodities Exchange copies
from the inputevent structure passed to cxtranslate() (newinputevent from
the function prototype above), in place of the deleted input event.

A translator is normally attached to some kind of filtering cxobject.  if
it wasn't, it would translate all input events into the same exact input
event.  Like the sender cxobject, a translator does not divert cxmessages
down its personal list, so it doesn't serve any purpose to add any to it.

    void SetTranslate( CxObj *translator, struct InputEvent *ie );

It is possible to change the inputevent structure that a translator looks
at when it creates and introduces new input events into the input stream.
The function settranslate() accepts a pointer to the new inputevent
structure, which the translator will duplicate and introduce when it
receives a cxmessage.

HotKey utilizes a special kind of translator.  Instead of supplying a new
input event, HotKey passes a NULL to cxtranslate().  if a translator has a
NULL new input event pointer, it does not introduce a new input event, but
still eliminates any cxmessages and corresponding input events it receives.