1
0
Fork 0
forked from wry/wry

io-uring: add readable/writable

This commit is contained in:
Julian Orth 2022-05-12 20:33:58 +02:00
parent 25d817b722
commit dcdd91c0b0
31 changed files with 285 additions and 189 deletions

View file

@ -1,6 +1,5 @@
use {
crate::{
async_engine::FdStatus,
backend::{AxisSource, InputEvent, KeyState, ScrollAxis},
backends::metal::MetalBackend,
fixed::Fixed,
@ -12,9 +11,10 @@ use {
},
event::LibInputEvent,
},
utils::errorfmt::ErrorFmt,
utils::{bitflags::BitflagsExt, errorfmt::ErrorFmt},
},
std::rc::Rc,
uapi::c,
};
macro_rules! unpack {
@ -49,7 +49,7 @@ macro_rules! unpack {
impl MetalBackend {
pub async fn handle_libinput_events(self: Rc<Self>) {
loop {
match self.libinput_fd.readable().await {
match self.state.ring.readable(&self.libinput_fd).await {
Err(e) => {
log::error!(
"Cannot wait for libinput fd to become readable: {}",
@ -57,7 +57,7 @@ impl MetalBackend {
);
break;
}
Ok(FdStatus::Err) => {
Ok(n) if n.intersects(c::POLLERR | c::POLLHUP) => {
log::error!("libinput fd fd is in an error state");
break;
}