Skip to main content

InputEvent

Type Alias InputEvent 

Source
pub type InputEvent = Event;
Expand description

Alias used by platform backends for standard events.

Aliased Type§

pub enum InputEvent {
Show 16 variants Tick, PointerDown { x: i32, y: i32, }, PointerUp { x: i32, y: i32, }, PointerMove { x: i32, y: i32, }, Touch { count: u8, points: [TouchPoint; 5], }, PressDown { x: i32, y: i32, }, PressRelease { x: i32, y: i32, }, DoubleTap { x: i32, y: i32, }, DragStart { x: i32, y: i32, origin_x: i32, origin_y: i32, }, DragMove { x: i32, y: i32, }, DragEnd { x: i32, y: i32, }, KeyDown { key: Key, }, KeyUp { key: Key, }, Encoder { diff: i32, }, LongPress { x: i32, y: i32, }, LongPressRepeat { x: i32, y: i32, },
}

Variants§

§

Tick

Called periodically to advance animations or timers.

§

PointerDown

A pointer (mouse or touch) was pressed at the given coordinates.

Fields

§x: i32

Horizontal coordinate relative to the widget origin.

§y: i32

Vertical coordinate relative to the widget origin.

§

PointerUp

The pointer was released.

Fields

§x: i32

Horizontal coordinate relative to the widget origin.

§y: i32

Vertical coordinate relative to the widget origin.

§

PointerMove

The pointer moved while still pressed.

Fields

§x: i32

Horizontal coordinate relative to the widget origin.

§y: i32

Vertical coordinate relative to the widget origin.

§

Touch

Multi-touch frame with per-point data.

Emitted when two or more simultaneous contacts are detected. Only points[..count] entries are valid.

Fields

§count: u8

Number of active contact points (2..=[MAX_TOUCH_POINTS]).

§points: [TouchPoint; 5]

Per-point data. Entries beyond count are meaningless.

§

PressDown

Stable contact began (debounced). Use for visual press feedback such as button highlighting. Emitted by the gesture recognizer, not by raw hardware input.

Fields

§x: i32

Horizontal coordinate.

§y: i32

Vertical coordinate.

§

PressRelease

Stable contact released (debounced). The primary “click/tap” action trigger. Widgets should match this instead of PointerUp for reliable single-fire behavior.

Fields

§x: i32

Horizontal coordinate.

§y: i32

Vertical coordinate.

§

DoubleTap

Two consecutive short taps detected at the given coordinates. Emitted by the DoubleTapRecognizer when two PressRelease events with short hold durations occur within the double-tap time window.

Fields

§x: i32

Horizontal coordinate.

§y: i32

Vertical coordinate.

§

DragStart

A drag gesture started: the pointer moved at least the start threshold away from its press origin. Emitted once per drag by the DragRecognizer. A contact that starts a drag will not also produce a PressRelease (click-vs-drag suppression — INPUT-00 §6).

Fields

§x: i32

Horizontal coordinate of the move that crossed the threshold.

§y: i32

Vertical coordinate of the move that crossed the threshold.

§origin_x: i32

Horizontal coordinate of the originating press.

§origin_y: i32

Vertical coordinate of the originating press.

§

DragMove

Pointer position update while a drag is in progress. Emitted by the DragRecognizer for every PointerMove after DragStart.

Fields

§x: i32

Horizontal coordinate.

§y: i32

Vertical coordinate.

§

DragEnd

The dragged pointer lifted; drop position for resolution logic. Emitted by the DragRecognizer in place of the raw PointerUp.

Fields

§x: i32

Horizontal coordinate.

§y: i32

Vertical coordinate.

§

KeyDown

A keyboard key was pressed.

Fields

§key: Key

Key that was pressed.

§

KeyUp

A keyboard key was released.

Fields

§key: Key

Key that was released.

§

Encoder

Rotary encoder rotation since the last read, in detent steps (positive clockwise). Mirrors lv_indev_data_t::enc_diff. Emitted by an encoder input device, not by raw hardware (LPAR-04 §5.5).

Fields

§diff: i32

Net rotation steps since the previous read.

§

LongPress

A held contact reached the long-press threshold. Emitted once per contact by the long-press recognizer (LPAR-04 §9). A pending long press is disarmed by DragStart.

Fields

§x: i32

Horizontal coordinate of the held contact.

§y: i32

Vertical coordinate of the held contact.

§

LongPressRepeat

A long-pressed contact crossed another repeat interval. Emitted every repeat period after the initial LongPress by the long-press recognizer (LPAR-04 §9).

Fields

§x: i32

Horizontal coordinate of the held contact.

§y: i32

Vertical coordinate of the held contact.