pub struct KeyboardBinding { /* private fields */ }
Expand description
A KeyboardBinding
represents a connection to a keyboard input device.
The KeyboardBinding
parses and exposes keyboard device descriptor properties (e.g., the
available keyboard keys) for the device it is associated with. It also parses InputReport
s
from the device, and sends them to the device binding owner over event_sender
.
Implementations§
Source§impl KeyboardBinding
impl KeyboardBinding
Sourcepub async fn new(
device_proxy: InputDeviceProxy,
device_id: u32,
input_event_sender: UnboundedSender<InputEvent>,
device_node: Node,
metrics_logger: MetricsLogger,
) -> Result<Self, Error>
pub async fn new( device_proxy: InputDeviceProxy, device_id: u32, input_event_sender: UnboundedSender<InputEvent>, device_node: Node, metrics_logger: MetricsLogger, ) -> Result<Self, Error>
Creates a new InputDeviceBinding
from the device_proxy
.
The binding will start listening for input reports immediately and send new InputEvents
to the device binding owner over input_event_sender
.
§Parameters
device_proxy
: The proxy to bind the newInputDeviceBinding
to.device_id
: The unique identifier of this device.input_event_sender
: The channel to send new InputEvents to.device_node
: The inspect node for this device bindingmetrics_logger
: The metrics logger.
§Errors
If there was an error binding to the proxy.
Sourcepub fn to_modifiers(keys: &[&Key]) -> Option<Modifiers>
pub fn to_modifiers(keys: &[&Key]) -> Option<Modifiers>
Converts a vector of keyboard keys to the appropriate fidl_ui_input3::Modifiers
bitflags.
For example, if keys
contains Key::CapsLock
, the bitflags will contain the corresponding
flags for CapsLock
.
§Parameters
keys
: The keys to check for modifiers.
§Returns
Returns None
if there are no modifier keys present.