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,4 +1,6 @@
use crate::{event::{KeyboardEvent, PointerEvent}, consumer::SyncConsumer};
use anyhow::Result;
use async_trait::async_trait;
use crate::{event::{KeyboardEvent, PointerEvent}, consumer::EventConsumer};
use winapi::{
self,
um::winuser::{INPUT, INPUT_MOUSE, LPINPUT, MOUSEEVENTF_MOVE, MOUSEINPUT,
@@ -25,8 +27,9 @@ impl WindowsConsumer {
pub fn new() -> Self { Self { } }
}
impl SyncConsumer for WindowsConsumer {
fn consume(&mut self, event: Event, _: ClientHandle) {
#[async_trait]
impl EventConsumer for WindowsConsumer {
async fn consume(&mut self, event: Event, _: ClientHandle) {
match event {
Event::Pointer(pointer_event) => match pointer_event {
PointerEvent::Motion {
@@ -48,9 +51,11 @@ impl SyncConsumer for WindowsConsumer {
}
}
fn notify(&mut self, _: ClientEvent) {
async fn notify(&mut self, _: ClientEvent) {
// nothing to do
}
async fn destroy(&mut self) {}
}
fn send_mouse_input(mi: MOUSEINPUT) {