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

Mouse events are broadcast to the application via the IDCMP or the console
device.  See the "intuition input and output methods" chapter in this book
for information on the IDCMP.  See the "console device" chapter in the
Amiga ROM Kernel Reference Manual: Devices for more about the console
device.

Simple mouse button activity not associated with any Intuition function
will be reported to the window as an intuimessage with a class of
idcmp_mousebuttons.  the intuimessage code field will be set to
SELECTDOWN, SELECTUP, MIDDLEDOWN, MIDDLEUP, MENUDOWN or MENUUP to specify
changes in the state of the left, middle and right buttons, respectively.

Direct select button events will not be received by the program if the
select button is pressed while the pointer is positioned over a gadget or
other object which uses the button event.  For example, select button
activity over a gadget is reported with a class of idcmp_gadgetdown or
idcmp_gadgetup.  the gadget is said to have consumed the mouse events and
produced gadget events.

If the menu system is enabled, menu selections appear with a class of
idcmp_menupick.  to directly receive menu button events, the application
must set the flag wflg_rmbtrap for the window either when the window is
opened or by changing the flag in a single, atomic operation.  See the
chapter "intuition windows" for more information on the flag wflg_rmbtrap.

The program receives mouse position changes in the event class
idcmp_mousemove.  the mousex and mousey position coordinates describe the
position of the mouse relative to the upper left corner of the reference
window.  These coordinates are always in the resolution of the screen
being used, and may represent any pixel position on the screen, even
though the hardware sprites can be positioned only on the even numbered
pixels of a high resolution screen and on the even numbered rows of an
interlaced screen.  Enabling IDCMP_MOUSEMOVE messages is discussed below
in the section on "the pointer".

To get mouse movement reported as deltas (amount of change from the last
position) instead of as absolute positions, set the IDCMP flag
idcmp_deltamove.  when idcmp_deltamove is set, the idcmp_mousemove
messages received by the program will have delta values rather than
absolute values.  Note that IDCMP_DELTAMOVE is simply a flag used to
modify the behavior of IDCMP_MOUSEMOVE, and that no messages of class
IDCMP_DELTAMOVE are ever sent.

Each window has a queue limit for the number of idcmp_mousemove messages
waiting on its IDCMP at any given time.  If the number of mouse move
messages waiting at the IDCMP is equal to the queue limit, then Intuition
will discard additional IDCMP_MOUSEMOVE messages until the application
replies to one of the queued mouse move messages.  The default queue limit
for mouse move messages is five.

Be aware that this may cause some data loss, especially when the
application is using idcmp_deltamove, as the information contained in the
discarded messages is not repeated.  When using IDCMP_DELTAMOVE, this
could cause the application to lose track of the actual pointer position.
The application may wish to change the default mouse queue size if it is
unable to reply to messages queued at the IDCMP for an extended period.
The mouse queue can be set when the window is opened by using the
wa_mousequeue tag, and may later be modified using the setmousequeue()
call.  Note that the actual mouse position is always available to the
application through the window structure mousex and mousey.