Skip to main content

Module cursor

Module cursor 

Source
Expand description

Pointer capture modes and cursor shapes.

§Three pointer modes, and why “hidden” is not one of them

PointerMode is about where the pointer may go; visibility is a separate axis, set through Shell::set_cursor with None. Collapsing the two — a Hidden mode — is tempting and wrong: a text editor hides the cursor while typing without capturing it, and a strategy game confines the pointer to the window while keeping it perfectly visible. Two axes, two settings.

§Cursor shapes are a fixed enum, not an image

CursorIcon names shapes rather than carrying pixels because every platform already has themed, correctly-scaled, user-configured cursors and shipping our own would mean shipping them at every scale factor and ignoring the user’s theme. Custom cursor images are a real feature for an editor (drag-and-drop ghosts) and are deliberately out of scope here; they can be added as a separate call that takes a pixel buffer without disturbing this enum.

The names follow the CSS cursor keywords, which is the same vocabulary the Wayland cursor-shape-v1 protocol adopted and which every X11 cursor theme is indexed by.

Enums§

CursorIcon
A standard cursor shape, defined in crcbl_core::input so the UI can name one without depending on the shell. A standard cursor shape.
PointerMode
Where the pointer is allowed to go.