Next: Keyboard Operations
Up: Graphics
Previous: Protecting Graphics Operations
The graphics library contains functions that determine where the
mouse is, if there are any clicks, etc.
The functions get-mouse-click and ready-mouse-click first
return a ``mouse-click descriptor,'' and then other functions take
the descriptor and return the mouse's position, which button was
pushed, etc.
-
(get-mouse-click viewport)
get-mouse-click takes a viewport descriptor and returns
a mouse click descriptor.
It returns the next mouse click in the viewport, waiting for a click
if necessary. -
(ready-mouse-click viewport)
ready-mouse-click takes a viewport descriptor and returns
either a mouse click descriptor, or else #f if none is available.
Unlike the previous function, ready-mouse-click returns immediately. -
(ready-mouse-release viewport)
ready-mouse-release takes a viewport descriptor and returns
either a click descriptor from a mouse-release (button-up) event,
or else #f if none is available. -
(query-mouse-posn viewport)
query-mouse-posn takes a viewport descriptor and returns
either the position of the mouse cursor within the viewport,
or else #f if the cursor is currently outside the viewport. -
(mouse-click-posn mouse-click)
mouse-click-posn takes a mouse click descriptor and
returns the position of the pixel where the click occurred. -
(left-mouse-click? mouse-click)
left-mouse-click? takes a mouse click descriptor and returns
#t if the click occurred with the left mouse button,
or else #f. -
(middle-mouse-click? mouse-click)
Similar to left-mouse-click?. -
(right-mouse-click? mouse-click)
Similar to left-mouse-click?. -
(viewport-flush-input viewport)
As noted above, mouse clicks are buffered.
viewport-flush-input takes a viewport descriptor
and empties the input buffer of mouse and keyboard events.
This action is useful in some real-time applications.
It returns unspecified.
PLT