Struct ndk::input_queue::InputQueue

source ·
pub struct InputQueue { /* private fields */ }
Expand description

A native AInputQueue *

An input queue is the facility through which you retrieve input events.

Implementations§

source§

impl InputQueue

source

pub unsafe fn from_ptr(ptr: NonNull<AInputQueue>) -> Self

Construct an InputQueue from the native pointer.

Safety

By calling this function, you assert that the pointer is a valid pointer to an NDK ffi::AInputQueue.

source

pub fn ptr(&self) -> NonNull<AInputQueue>

source

pub fn event(&self) -> Result<Option<InputEvent>>

Returns the next available InputEvent from the queue.

Returns None if no event is available.

source

pub fn has_events(&self) -> bool

Returns true if there are one or more events available in the input queue.

source

pub fn pre_dispatch(&self, event: InputEvent) -> Option<InputEvent>

Sends the key for standard pre-dispatching that is, possibly deliver it to the current IME to be consumed before the app.

Returns Some if it was not pre-dispatched, meaning you can process it right now. If None is returned, you must abandon the current event processing and allow the event to appear again in the event queue (if it does not get consumed during pre-dispatching).

Also returns None if event is not a KeyEvent.

source

pub fn finish_event(&self, event: InputEvent, handled: bool)

Report that dispatching has finished with the given InputEvent.

This must be called after receiving an event with InputQueue::event().

source

pub fn attach_looper(&self, looper: &ForeignLooper, id: i32)

Add this input queue to a ForeignLooper for processing.

See ForeignLooper::add_fd() for information on the ident, callback, and data params.

source

pub fn detach_looper(&self)

Remove this input queue from the ForeignLooper it is currently attached to.

Trait Implementations§

source§

impl Debug for InputQueue

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Send for InputQueue

source§

impl Sync for InputQueue

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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.

source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.