![[index]](../icons/index.gif)
Next: Keyboard Operations
Up: Viewport 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.
Mouse clicks are buffered and returned in the same order in which
they occurred.
Thus, the descriptors returned by get-mouse-click and
ready-mouse-click may be from clicks that occurred long
before these functions were called.
-
(get-mouse-click viewport)
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)
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)
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)
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)
Takes a mouse click descriptor and
returns the position of the pixel where the click occurred.
-
(left-mouse-click? 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.
![[index]](../icons/index.gif)
Next: Keyboard Operations
Up: Viewport Graphics
Previous: Protecting Graphics Operations
PLT