The input library tracks available input devices, manages device state, and allows the session to register handlers for events.
The session creates an input pipeline that is configured for the specific product. First, the session decides which types of input devices the input pipeline should support. Then, the session registers input handlers for input events.
The input library provides implementations for common input handlers, such as Scenic and input method editors (IME). After the session instantiates components that consume input, the input pipeline directly sends input events to those components through the registered input handlers.
InputDeviceBindingrepresents a connection to a physical input device (e.g. mouse, keyboard).
InputHandlerrepresents a client of
An input pipeline routes input from physical devices to various clients by doing the following:
- Detects and binds to new input devices as they appear in
Session authors are responsible for setting up input pipelines. More details on how can be found in input_pipeline.rs.
InputDeviceBinding does the following:
- Connects to an
InputReportfile located at
InputEvents from the
The input pipeline creates and owns
InputDeviceBindings as new input
peripherals are connected to a device.
InputHandler receives an
InputEvent, it does at least one of the
- Forwards the
InputEventto the relevant client component.
- Outputs a vector of
InputEvents for the next
InputHandlers must satisfy at least one of these conditions, but otherwise
their implementation details can vary.
The developer guide includes an
example implementation of an