Libei support - input emulation (#33)

Add support for input emulation through libei!
This commit is contained in:
Ferdinand Schober
2023-12-03 12:55:30 -08:00
committed by Ferdinand Schober
parent e6677c3061
commit 74eebc07d8
18 changed files with 570 additions and 265 deletions

View File

@@ -1,42 +1,32 @@
use std::io::Result;
use std::os::fd::{AsRawFd, self};
use std::vec::Drain;
use std::io;
use std::task::Poll;
use tokio::io::unix::AsyncFd;
use futures_core::Stream;
use crate::event::Event;
use crate::producer::EventProducer;
use crate::client::{ClientEvent, ClientHandle};
pub struct X11Producer {
pending_events: Vec<(ClientHandle, Event)>,
}
pub struct X11Producer { }
impl X11Producer {
pub fn new() -> Self {
Self {
pending_events: vec![],
}
}
}
impl AsRawFd for X11Producer {
fn as_raw_fd(&self) -> fd::RawFd {
todo!()
Self { }
}
}
impl EventProducer for X11Producer {
fn notify(&mut self, _: ClientEvent) { }
fn read_events(&mut self) -> Drain<(ClientHandle, Event)> {
self.pending_events.drain(..)
}
fn release(&mut self) {}
}
fn get_async_fd(&self) -> Result<AsyncFd<fd::RawFd>> {
todo!()
impl Stream for X11Producer {
type Item = io::Result<(ClientHandle, Event)>;
fn poll_next(self: std::pin::Pin<&mut Self>, _cx: &mut std::task::Context<'_>) -> std::task::Poll<Option<Self::Item>> {
Poll::Pending
}
}