Allow input capture & emulation being disabled (#158)

* Input capture and emulation can now be disabled and will prompt the user to enable again.

* Improved error handling to deliver more useful error messages
This commit is contained in:
Ferdinand Schober
2024-07-16 20:34:46 +02:00
committed by GitHub
parent 55bdf1e63e
commit bea7d6f8a5
41 changed files with 2079 additions and 1543 deletions

View File

@@ -1,10 +1,9 @@
use async_trait::async_trait;
use error::EmulationError;
use std::fmt::Display;
use input_event::Event;
use self::error::EmulationCreationError;
pub use self::error::{EmulationCreationError, EmulationError, InputEmulationError};
#[cfg(windows)]
pub mod windows;
@@ -76,6 +75,7 @@ pub trait InputEmulation: Send {
) -> Result<(), EmulationError>;
async fn create(&mut self, handle: EmulationHandle);
async fn destroy(&mut self, handle: EmulationHandle);
async fn terminate(&mut self);
}
pub async fn create_backend(
@@ -131,6 +131,7 @@ pub async fn create(
log::info!("using emulation backend: {backend}");
return Ok(b);
}
Err(e) if e.cancelled_by_user() => return Err(e),
Err(e) => log::warn!("{e}"),
}
}