Skip to main content

Module input

Module input 

Source
Expand description

Pointer, keyboard, drag, IME, and file-drop event types plus shared input resources.

  • Window backends translate raw OS events into the typed messages defined here.
  • lumen-input reads them to drive hit-testing, focus routing, and Click/Hover dispatch.

Structs§

ClickEvent
Emitted by lumen-input when a press and release land on the same entity without leaving it.
ClipboardRead
Emitted once a clipboard_read(tag) request has pulled the system clipboard text. Routed as on_clipboard(tag, text) and through on("clipboard", tag, fn).
CloseRequest
Emitted by window backends on WindowEvent::CloseRequested. Apps that want to veto the close (e.g. to show a “save before quit?” dialog) set vetoed = true in a system reading this message; if no system vetoes, the backend exits the event loop on the next about_to_wait.
CursorRequest
Requested mouse cursor, written main-side each tick (see lumen_primitives::update_cursor_request) and applied to the OS window by the window backend, which tracks the last applied value so the OS call only happens on change. Headless runners simply never read it.
DialogClosed
Emitted exactly once per <dialog> close (open -> closed edge).
DoubleClickEvent
Emitted by lumen-primitives::press when two ClickEvents land on the same entity within the double-click window (default 300 ms).
DragEndEvent
Emitted once when the pointer releases at the end of an active drag.
DragMoveEvent
Emitted on each pointer move while a drag is active on the entity.
DragStartEvent
Emitted once when the pointer moves past the drag-start threshold while pressed on the entity.
EscapePressCancel
Tick-scoped flag written by lumen_input::cancel_press_on_escape: true exactly on ticks where an Escape key-press cancelled an in-flight press (an entity carried Pressed). Consumers that also react to Escape (dialog / popup close handlers) should treat such an Escape as consumed and leave their state alone - cancelling a press and closing a dialog must never happen on the same keystroke.
FileDropped
Emitted when a file drops on a [DropTarget]. entity is the topmost DropTarget under the cursor at drop time; drops without a matching target are not emitted.
FileHoverCancelled
Emitted when the user cancels a drag-and-drop session (release outside the window or Escape).
FileHovered
Emitted while a file is dragged over the window prior to drop; forwarded by backends from the OS drag-and-drop session.
FilePicked
Emitted when the user resolves a native file dialog (open / save / folder / multi-open).
FocusTracker
Resource mirror of Focused, letting systems look up the focused entity without a query.
FocusVisible
Marker placed alongside Focused when focus arrived via the keyboard (Tab / Shift-Tab cycling), mirroring the CSS :focus-visible heuristic. Pointer-driven focus (click-to-focus) carries Focused alone. Styling keyed on :focus-visible (keyboard-only focus rings) reads this marker; :focus styling stays always-on.
Focused
Marker placed by lumen-input’s focus router on the keyboard-focused entity. The router maintains at most one Focused at a time.
FocusedKey
Emitted by lumen-input on each KeyPressed when FocusTracker points at an entity; subscribe instead of KeyPressed for per-entity routing.
HotkeyFired
Emitted by the OS for a previously-registered global hotkey. Routed by the scripting layer as on_hotkey(name) and through on("hotkey", name, fn).
HotkeyReleased
Emitted when a previously-pressed global hotkey is released. Routed by the scripting layer as on_hotkey_release(name) and through on("hotkey_release", name, fn). Pairs with HotkeyFired so one chord can drive push-to-talk.
Hovered
Marker inserted/removed by the hit-test system to mark the entity currently under the pointer; matched by style systems for :hover behaviour.
ImeRequest
Per-window IME control written by lumen-input’s focus router and read by the window backend, which forwards changes to winit’s set_ime_allowed and set_ime_cursor_area.
KeyPressed
Raw global key-press event. Subscribe directly for global shortcuts, or read FocusedKey for per-entity routing through lumen-input.
KeyReleased
Raw global key-release event.
LongPressEvent
Emitted by lumen-primitives::press when an entity has carried Pressed continuously past the configured long-press threshold (default 500 ms).
MenuClicked
Emitted when the user clicks a native menu item. Routed as on_menu(id) and through on("menu", id, fn).
Modifiers
Active keyboard modifier flags.
ModifiersState
Live modifier state, refreshed by the window backend on ModifiersChanged.
MouseWheel
Mouse-wheel scroll event. delta is in logical pixels (positive y scrolls content down). Backends normalise line-based wheel input to pixels with a fixed 32 px/line.
NotificationActionInvoked
Emitted when the user activates an action button on a desktop notification. Routed as on_notification_action(id, action_id) and through on("notification_action", id, fn).
PendingFileDrops
Pending file-drop entries from the OS this frame.
PointerLeft
Pointer left the window.
PointerMoved
Pointer moved to a new position in window coordinates.
PointerPressed
Pointer button pressed.
PointerReleased
Pointer button released.
PointerState
Aggregated pointer state refreshed each tick by the window backend.
Pressed
Marker indicating an active primary-button press on the entity. Inserted on PointerPressed; removed on PointerReleased and PointerLeft.
Scroll
Scrollable container configuration. Each instance carries its own sensitivity, inertia, and momentum.
ScrollOffset
Current scroll offset (positive = content shifted up/left).
ScrollbarDrag
An in-flight thumb drag (pointer captured by the scrollbar).
ScrollbarGeometry
Resolved geometry for one overlay bar, in window coordinates.
ScrollbarInteraction
Pointer <-> overlay-scrollbar arbitration, shared between lumen_primitives::scrollbar (writer) and lumen-input’s hit_test (reader). While the pointer is over a visible bar - or a thumb drag is active - the hit-test resolves to the scroll container itself, so bars sit above content for clicks/hover, wheel events still route through the container’s normal scroll chain (bars never steal wheel), and dragging keeps working when the pointer leaves the bar (pointer capture).
ScrollbarMetrics
Resolved geometry inputs for one bar, derived from ScrollbarStyle (see ScrollbarStyle::metrics).
ScrollbarState
Overlay-scrollbar paint + fade state, auto-attached to every Scroll entity by lumen_primitives::scrollbar::update_scrollbars (spec section 16.2 / section 16.6). The interaction FSM (hover / drag) is global per-pointer and lives in ScrollbarInteraction; this component only carries the per-container fade clock the extract pass reads.
ScrollbarStyle
Overlay-scrollbar styling for one scroll container - the runtime mirror of the standard CSS properties scrollbar-color: <thumb> [<track>] and scrollbar-width: auto | thin | none (CSS Scrollbars Styling Level 1; both transpile 1:1 to the web backend). Set from the stylesheet by lumenc; the skin defaults live in skins/default.css via the --lumen-scrollbar-* tokens.
ShowContextMenu
Emitted by the a11y inbound-action plumbing (and any other route) when assistive technology asks an entity to present a context menu.
TextInputCommitted
Emitted by lumen-input’s IME router after splicing a commit segment into [TextContent].
TrayClicked
Emitted when the user clicks a system tray icon. Routed as on_tray(id) and through on("tray", id, fn).
WindowFocused
Emitted by window backends when the OS reports the window gained or lost keyboard focus. Backends also pause the redraw scheduler while focused = false so unfocused windows stop polling at vsync.
WindowOccluded
Emitted by window backends when the OS reports the window was occluded (covered by another window or moved off-screen) or revealed. Backends pause the redraw scheduler while occluded = true to avoid spending GPU on invisible frames.

Enums§

CursorShape
Cursor shape the UI wants for the current pointer position. Deliberately tiny - only the shapes Lumen widgets actually request; window backends map it onto the OS cursor set (winit CursorIcon).
ImeEvent
IME (input-method editor) state-machine event forwarded by window backends. The variant set mirrors winit’s Ime enum.
Key
Logical key, either a named navigation key or a Unicode character cluster (already resolved through modifiers and IME).
NamedKey
Named non-printable keys recognised by Lumen.
PointerButton
Mouse button identifier carried by pointer-press and pointer-release messages.
ScrollAxis
Axis (or axes) a scroll container responds to. Used by lumen-input for scroll-aware hit-testing and by lumen-primitives for the accumulator and extract.
ScrollbarAxisPick
Axis of the bar under the pointer.
ScrollbarPart
Which functional part of an overlay scrollbar the pointer is on.
ScrollbarWidthMode
CSS scrollbar-width keyword (CSS Scrollbars Styling Level 1).

Constants§

SCROLLBAR_FADE_DELAY_SECS
Fallback idle time, in seconds, before an overlay scrollbar starts fading out.
SCROLLBAR_FADE_SECS
Fallback fade-out ramp length, in seconds.
SCROLLBAR_HOVER_BOOST
Fallback thumb alpha multiplier while hovered / dragged.
SCROLLBAR_HOVER_TRACK
Fallback hover-only track fill used when no scrollbar-color track value is authored.
SCROLLBAR_MARGIN
Fallback inset from the viewport edges, in logical pixels.
SCROLLBAR_MIN_THUMB
Fallback minimum thumb length in logical pixels - a 100 000-px document must still leave a grabbable thumb.
SCROLLBAR_THICKNESS
Fallback overlay bar thickness (scrollbar-width: auto).
SCROLLBAR_THICKNESS_THIN
Narrow rail thickness (scrollbar-width: thin).

Functions§

horizontal_scrollbar
Horizontal counterpart of vertical_scrollbar (bar along the bottom edge).
vertical_scrollbar
Geometry for the vertical overlay bar of a viewport at (viewport_origin, viewport_size) whose content is content_h tall, scrolled to offset_y. Returns None when the content does not overflow (as-needed visibility, spec section 16.2). corner_reserved should be true when the horizontal bar is also visible so the two bars don’t overlap in the corner. m supplies the style-resolved visual metrics (ScrollbarStyle::metrics).