Once a class of mouse events have been made visible in a
window, calling the 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 getmouse. This function
will return OK if a mouse event is actually visible
in the given window, ERR otherwise. When
getmouse returns OK, the data deposited as y
and x in the event structure coordinates will be
screen-relative character-cell coordinates. The returned
state mask will have exactly one bit set to indicate the
event type.
The ungetmouse function behaves analogously to
ungetch. 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.
The wenclose function tests whether a given pair
of screen-relative character-cell coordinates is enclosed by
a given window, returning TRUE if it is and FALSE otherwise.
It is useful for determining what subset of the screen
windows enclose the location of a mouse event.
The wmouse_trafo function transforms a given pair
of coordinates from stdscr-relative coordinates to
screen-relative coordinates or vice versa. Please remember,
that stdscr-relative coordinates are not always identical to
screen-relative coordinates due to the mechanism to reserve
lines on top or bottom of the screen for other purposes
(ripoff() call, see also slk_... functions). If the
parameter to_screen is TRUE, the pointers
pY, pX must reference the coordinates of a location
inside the window win. They are converted to
screen-relative coordinates and returned through the
pointers. If the conversion was successful, the function
returns TRUE. If one of the parameters was NULL or
the location is not inside the window, FALSE is
returned. If to_screen is FALSE, the pointers
pY, pX must reference screen-relative coordinates.
They are converted to stdscr-relative coordinates if the
window win encloses this point. In this case the
function returns TRUE. If one of the parameters is
NULL or the point is not inside the window, FALSE is
returned. Please notice, that the referenced coordinates are
only replaced by the converted coordinates if the
transformation was successful.
The mouseinterval function sets the maximum time
(in thousands of a second) that can elapse between press and
release events in order for them to be recognized as a
click. This function returns the previous interval value.
The default is one fifth of a second.
Note that mouse events will be ignored when input is in
cooked mode, and will cause an error beep when cooked mode
is being simulated in a window by a function such as
getstr that expects a linefeed for input-loop
termination.
|