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
sourceimpl InputQueue
impl InputQueue
sourcepub unsafe fn from_ptr(ptr: NonNull<AInputQueue>) -> Self
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
.
pub fn ptr(&self) -> NonNull<AInputQueue>
sourcepub fn get_event(&self) -> Result<Option<InputEvent>>
pub fn get_event(&self) -> Result<Option<InputEvent>>
Returns the next available InputEvent
from the queue.
Returns None
if no event is available.
sourcepub fn has_events(&self) -> bool
pub fn has_events(&self) -> bool
Returns true
if there are one or more events available in the input queue.
sourcepub fn pre_dispatch(&self, event: InputEvent) -> Option<InputEvent>
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).
sourcepub fn finish_event(&self, event: InputEvent, handled: bool)
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::get_event()
.
sourcepub fn attach_looper(&self, looper: &ForeignLooper, id: i32)
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.
sourcepub fn detach_looper(&self)
pub fn detach_looper(&self)
Remove this input queue from the ForeignLooper
it is currently attached to.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more