pub struct InputPipeline { /* private fields */ }
Expand description

An InputPipeline manages input devices and propagates input events through input handlers.

On creation, clients declare what types of input devices an InputPipeline manages. The InputPipeline will continuously detect new input devices of supported type(s).

§Example

let ime_handler =
    ImeHandler::new(scene_manager.session.clone(), scene_manager.compositor_id).await?;
let touch_handler = TouchHandler::new(
    scene_manager.session.clone(),
    scene_manager.compositor_id,
    scene_manager.display_size
).await?;

let assembly = InputPipelineAssembly::new()
    .add_handler(Box::new(ime_handler)),
    .add_handler(Box::new(touch_handler)),
let input_pipeline = InputPipeline::new(
    vec![
        input_device::InputDeviceType::Touch,
        input_device::InputDeviceType::Keyboard,
    ],
    assembly,
);
input_pipeline.handle_input_events().await;

Implementations§

source§

impl InputPipeline

source

pub fn new_for_test( input_device_types: Vec<InputDeviceType>, assembly: InputPipelineAssembly ) -> Self

Creates a new InputPipeline for integration testing. Unlike a production input pipeline, this pipeline will not monitor /dev/class/input-report for devices.

§Parameters
  • input_device_types: The types of devices the new InputPipeline will support.
  • assembly: The input handlers that the InputPipeline sends InputEvents to.
source

pub fn new( input_device_types: Vec<InputDeviceType>, assembly: InputPipelineAssembly, inspect_node: Node, metrics_logger: MetricsLogger ) -> Result<Self, Error>

Creates a new InputPipeline for production use.

§Parameters
  • input_device_types: The types of devices the new InputPipeline will support.
  • assembly: The input handlers that the InputPipeline sends InputEvents to.
  • inspect_node: The root node for InputPipeline’s Inspect tree
source

pub fn input_device_bindings(&self) -> &InputDeviceBindingHashMap

Gets the input device bindings.

source

pub fn input_event_sender(&self) -> &UnboundedSender<InputEvent>

Gets the input device sender: this is the channel that should be cloned and used for injecting events from the drivers into the input pipeline.

source

pub fn input_device_types(&self) -> &Vec<InputDeviceType>

Gets a list of input device types supported by this input pipeline.

source

pub async fn handle_input_events(self)

Forwards all input events into the input pipeline.

source

pub async fn handle_input_device_registry_request_stream( stream: InputDeviceRegistryRequestStream, device_types: &Vec<InputDeviceType>, input_event_sender: &UnboundedSender<InputEvent>, bindings: &InputDeviceBindingHashMap, device_id: u32, input_devices_node: &Node, metrics_logger: MetricsLogger ) -> Result<(), Error>

Handles the incoming InputDeviceRegistryRequestStream.

This method will end when the request stream is closed. If the stream closes with an error the error will be returned in the Result.

NOTE: Only one stream is handled at a time. https://fxbug.dev/42061078

§Parameters
  • stream: The stream of InputDeviceRegistryRequests.
  • device_types: The types of devices to watch for.
  • input_event_sender: The channel new InputDeviceBindings will send InputEvents to.
  • bindings: Holds all the InputDeviceBindings associated with the InputPipeline.
  • device_id: The device id of the associated bindings.
  • input_devices_node: The parent node for all injected devices’ inspect nodes.
  • metrics_logger: The metrics logger.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> AsRcAny for T
where T: Any,

source§

fn as_rc_any(self: Rc<T>) -> Rc<dyn Any>

source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Encode<Ambiguous1> for T

source§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _offset: usize, _depth: Depth ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
source§

impl<T> Encode<Ambiguous2> for T

source§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _offset: usize, _depth: Depth ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> IntoAny for T
where T: 'static + Send + Sync,

§

fn into_any(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Cast the given object into a dyn std::any::Any.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<St> WithTag for St

source§

fn tagged<T>(self, tag: T) -> Tagged<T, St>

Produce a new stream from this one which yields item tupled with a constant tag