These functions provide an interface to mouse events.
Mouse events are represented by
KEY_MOUSE pseudo-key values in the
wgetch input stream.
To make mouse events visible, use the
#t if the mouse driver has been successfully installed.
This will set the mouse events to be reported. By default, no mouse events are reported. The function will return a mask to indicate which of the specified mouse events can be reported; on complete failure it returns 0.
As a side effect, setting a zero mousemask may turn off the mouse pointer; setting a nonzero mask may turn it on. Whether this happens is device-dependent.
See Table 5.5 for the mouse event types mask that may be defined.
|mouse button 1 down|
|mouse button 1 up|
|mouse button 1 clicked|
|mouse button 1 double clicked|
|mouse button 1 triple clicked|
|mouse button 2 down|
|mouse button 2 up|
|mouse button 2 clicked|
|mouse button 2 double clicked|
|mouse button 2 triple clicked|
|mouse button 3 down|
|mouse button 3 up|
|mouse button 3 clicked|
|mouse button 3 double clicked|
|mouse button 3 triple clicked|
|mouse button 4 down|
|mouse button 4 up|
|mouse button 4 clicked|
|mouse button 4 double clicked|
|mouse button 4 triple clicked|
|mouse button 5 down|
|mouse button 5 up|
|mouse button 5 clicked|
|mouse button 5 double clicked|
|mouse button 5 triple clicked|
|shift was down during button state change|
|control was down during button state change|
|alt was down during button state change|
|report all button state changes|
|report mouse movement|
Once a class of mouse events have been made visible in a window,
wgetch function on that window may return
KEY_MOUSE as an indicator that a mouse event has been queued.
To read the event data and pop the event off the queue, call
This will return either a list of mouse information, or
it does return a list, it will have the following form:
(id ; id to distinguish multiple devices x y z ; event coordinates bstate) ; button state bits
getmouse returns a list, the data deposited as y and x in
the list will be screen-relative character-cell coordinates. The
returned state mask will have exactly one bit set to indicate the
ungetmouse function behaves analogously to
It pushes a
KEY_MOUSE event onto the input queue, and
associates with that event the given state data and screen-relative
character-cell coordinates in the mouse-event list, where
mouse-event is a list of five elements as described above.
mouse-trafo function transforms a given pair of
coordinates y, x from
to coordinates relative to the given window win or vice versa.
Please remember, that
stdscr-relative coordinates are not
always identical to window-relative coordinates due to the mechanism
to reserve lines on top or bottom of the screen for other purposes
slk-init, for example). If the parameter to-screen
#t, the procedure returns either a list of two elements
x) which is the location inside the window
#f if the location was not inside the window. If
#f, the return a list of two elements of
where the window-relative location y, x would be in
mouse-trafo procedure performs the same translation as
stdscr for win.
wenclose? function tests whether a given pair of
screen-relative character-cell coordinates is enclosed by the given
window win, returning
#t if it is and
otherwise. It is useful for determining what subset of the screen
windows enclose the location of a mouse event.
mouseinterval function sets the maximum time (in thousands of a
second) that can elapse between press and release events for them to
be recognized as a click. Use
(mouseinterval 0) to disable click
resolution. This function returns the previous interval value. Use
(mouseinterval -1) to obtain the interval without altering it. The
default is one sixth of a second.