Skip to main content

Module pen

Module pen 

Expand description

The stylus behind the pointer event a widget is handling.

A pen moves the cursor and clicks as a mouse does, so every widget works with one unchanged. A widget that wants more of it — a brush following pressure and tilt, the eraser end — asks EventCtx::pen while it handles a CursorMoved or MouseInput.

The platform reports a pen as WindowEvent::PenSample immediately before each pointer event it makes. Hosts pass every window event through PenInput::route: it keeps the sample, which no widget sees as an event of its own, and hands it to the pointer event that follows for exactly that event’s dispatch. A mouse’s events carry none.

Structs§

PenInput
One host’s pen samples on their way to the pointer events they describe.
PenSample
What a stylus reported with one pointer event.
PenScope
While alive, the pen of the pointer event being dispatched.