Documentation
¶
Overview ¶
Package cursor reads the host's system cursor: whether it shows, whether an app holds the mouse, and where it is.
Index ¶
Constants ¶
const MaxSide = 256
MaxSide bounds a Shape's width and height: a larger cursor is scaled down to fit.
Variables ¶
var ErrUnsupported = errors.New("cursor: not supported on this platform")
ErrUnsupported is what Read returns where the platform cannot tell.
Functions ¶
func DPIAt ¶ added in v0.2.1
DPIAt is the effective DPI of the display at a desktop point, 0 where the platform does not say.
func Foreground ¶ added in v0.2.1
Foreground is the window in front and its process, for input traces; zero where the platform does not say.
Types ¶
type Shape ¶
type Shape struct {
W, H int
HotX, HotY int
// DPI is the display's the cursor was sized for; 96 is 100%.
DPI int
// RGBA is the image, not premultiplied, rows top down.
RGBA []byte
}
Shape is the image of the system cursor.
func Fit ¶
Fit scales a shape larger than side down to fit, nearest pixel, and its DPI with it, each pixel the one at its centre, so that it keeps its size on the client.
type State ¶
type State struct {
Visible bool
// Captured is set while an app confines the cursor to less than the
// whole desktop, as a game holding the mouse does. A hidden cursor
// alone is not captured: a page's cursor: none, a video player and
// Windows hiding the pointer while typing all hide it.
Captured bool
// X and Y are the cursor's place on the desktop, in physical pixels.
X, Y int
// Handle is the system's handle of the cursor's image, which changes
// as the cursor changes shape; 0 while none shows.
Handle uintptr
// Clip is the rectangle the cursor is confined to and Desktop the
// bounds of every display, where the platform says (Windows).
Clip, Desktop Rect
}
State is the system cursor.