Skip to main content

Module pointer_icon_session

Module pointer_icon_session 

Source
Expand description

The pointer icon the platform should be drawing right now.

The shell resolves the hovered region’s PointerIcon on every pointer move and records it here; the platform layer reads the pending change back and applies it to the window it owns (winit’s Window::set_cursor on desktop, the canvas’s CSS cursor on the web). The indirection exists because neither side can call the other directly: cranpose-ui cannot reach a window handle, and the platform backend is not on the stack when a modifier declares its icon.

Reading is a poll rather than a callback because a windowing system wants the cursor set from its own event loop, holding the handles only that loop has: the platform asks for the change at the point where it can act on it.

The session is stored per AppContext, like the clipboard and text-input sessions, so each window in a multi-window app carries its own pointer icon.

Structs§

PointerIconState
The icon one window’s pointer shows, with the change its platform has not applied yet. The app context keeps one for callers of the free functions below; a shell keeps one per surface, because the OS owns cursors per window.

Functions§

current_pointer_icon
The pointer icon currently requested, whether or not the platform has applied it yet.
refresh_pointer_icon
Offers the icon the session already holds to the platform again.
set_pointer_icon
Requests icon as the pointer’s appearance.
take_pointer_icon_change
Takes the pointer icon change the platform has not applied yet, leaving nothing behind.