[][src]Module winit::event

The Event enum and assorted supporting types.

These are sent to the closure given to EventLoop::run(...), where they get processed and used to modify the program state. For more details, see the root-level documentation.

Some of these events represent different "parts" of a traditional event-handling loop. You could approximate the basic ordering loop of EventLoop::run(...) like this:

This example is not tested
let mut control_flow = ControlFlow::Poll;
let mut start_cause = StartCause::Init;

while control_flow != ControlFlow::Exit {
    event_handler(NewEvents(start_cause), ..., &mut control_flow);

    for e in (window events, user events, device events) {
        event_handler(e, ..., &mut control_flow);
    }
    event_handler(MainEventsCleared, ..., &mut control_flow);

    for w in (redraw windows) {
        event_handler(RedrawRequested(w), ..., &mut control_flow);
    }
    event_handler(RedrawEventsCleared, ..., &mut control_flow);

    start_cause = wait_if_necessary(control_flow);
}

event_handler(LoopDestroyed, ..., &mut control_flow);

This leaves out timing details like ControlFlow::WaitUntil but hopefully describes what happens in what order.

Structs

DeviceId

Identifier of an input device.

KeyboardInput

Describes a keyboard input event.

ModifiersState

Represents the current state of the keyboard modifiers

Touch

Represents a touch event

Enums

DeviceEvent

Represents raw hardware events that are not associated with any particular window.

ElementState

Describes the input state of a key.

Event

Describes a generic event.

Force

Describes the force of a touch event

MouseButton

Describes a button of a mouse controller.

MouseScrollDelta

Describes a difference in the mouse scroll wheel state.

StartCause

Describes the reason the event loop is resuming.

TouchPhase

Describes touch-screen input state.

VirtualKeyCode

Symbolic name for a keyboard key.

WindowEvent

Describes an event from a Window.

Type Definitions

AxisId

Identifier for a specific analog axis on some device.

ButtonId

Identifier for a specific button on some device.

ScanCode

Hardware-dependent keyboard scan code.