Module event

Source
Expand description

The event enums and assorted supporting types.

These are sent to the closure given to EventLoop::run_app(...), 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_app(...) like this:

let mut start_cause = StartCause::Init;

while !elwt.exiting() {
    app.new_events(event_loop, start_cause);

    for event in (window events, user events, device events) {
        // This will pick the right method on the application based on the event.
        app.handle_event(event_loop, event);
    }

    for window_id in (redraw windows) {
        app.window_event(event_loop, window_id, RedrawRequested);
    }

    app.about_to_wait(event_loop);
    start_cause = wait_if_necessary();
}

app.exiting(event_loop);

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

Structs§

DeviceId
Identifier of an input device.
FingerId
Identifier of a finger in a touch event.
KeyEvent
Describes a keyboard input targeting a window.
Modifiers
Describes keyboard modifiers event.
RawKeyEvent
Describes a keyboard input as a raw device event.
SurfaceSizeWriter
Handle to synchronously change the size of the window from the WindowEvent.
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
Ime
Describes input method events.
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.
WindowEvent
Describes an event from a [Window].

Type Aliases§

AxisId
Identifier for a specific analog axis on some device.
ButtonId
Identifier for a specific button on some device.