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,15 +1,18 @@
use std::ptr;
use async_trait::async_trait;
use x11::{xlib, xtest};
use crate::{
client::ClientHandle,
event::Event, consumer::SyncConsumer,
event::Event, consumer::EventConsumer,
};
pub struct X11Consumer {
display: *mut xlib::Display,
}
unsafe impl Send for X11Consumer {}
impl X11Consumer {
pub fn new() -> Self {
let display = unsafe {
@@ -30,8 +33,9 @@ impl X11Consumer {
}
}
impl SyncConsumer for X11Consumer {
fn consume(&mut self, event: Event, _: ClientHandle) {
#[async_trait]
impl EventConsumer for X11Consumer {
async fn consume(&mut self, event: Event, _: ClientHandle) {
match event {
Event::Pointer(pointer_event) => match pointer_event {
crate::event::PointerEvent::Motion {
@@ -50,8 +54,10 @@ impl SyncConsumer for X11Consumer {
}
}
fn notify(&mut self, _: crate::client::ClientEvent) {
async fn notify(&mut self, _: crate::client::ClientEvent) {
// for our purposes it does not matter what client sent the event
}
async fn destroy(&mut self) {}
}