fix windows

This commit is contained in:
Ferdinand Schober
2024-07-01 17:16:36 +02:00
parent 3c2f9da5b7
commit db2004fd02
2 changed files with 10 additions and 2 deletions

View File

@@ -20,6 +20,8 @@ pub enum EmulationCreationError {
X11(#[from] X11EmulationCreationError), X11(#[from] X11EmulationCreationError),
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
MacOs(#[from] MacOSEmulationCreationError), MacOs(#[from] MacOSEmulationCreationError),
#[cfg(windows)]
Windows(#[from] WindowsEmulationCreationError),
NoAvailableBackend, NoAvailableBackend,
} }
@@ -36,6 +38,8 @@ impl Display for EmulationCreationError {
EmulationCreationError::X11(e) => format!("x11 backend: {e}"), EmulationCreationError::X11(e) => format!("x11 backend: {e}"),
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
EmulationCreationError::MacOs(e) => format!("macos backend: {e}"), EmulationCreationError::MacOs(e) => format!("macos backend: {e}"),
#[cfg(windows)]
EmulationCreationError::Windows(e) => format!("windows backend: {e}"),
EmulationCreationError::NoAvailableBackend => "no backend available".to_string(), EmulationCreationError::NoAvailableBackend => "no backend available".to_string(),
}; };
write!(f, "could not create input emulation backend: {reason}") write!(f, "could not create input emulation backend: {reason}")
@@ -158,3 +162,7 @@ impl Display for MacOSEmulationCreationError {
} }
} }
} }
#[cfg(windows)]
#[derive(Debug, Error)]
pub enum WindowsEmulationCreationError {}

View File

@@ -1,9 +1,9 @@
use super::error::WindowsEmulationCreationError;
use crate::{ use crate::{
emulate::InputEmulation, emulate::InputEmulation,
event::{KeyboardEvent, PointerEvent}, event::{KeyboardEvent, PointerEvent},
scancode, scancode,
}; };
use anyhow::Result;
use async_trait::async_trait; use async_trait::async_trait;
use std::ops::BitOrAssign; use std::ops::BitOrAssign;
use std::time::Duration; use std::time::Duration;
@@ -33,7 +33,7 @@ pub struct WindowsEmulation {
} }
impl WindowsEmulation { impl WindowsEmulation {
pub fn new() -> Result<Self> { pub fn new() -> Result<Self, WindowsEmulationCreationError> {
Ok(Self { repeat_task: None }) Ok(Self { repeat_task: None })
} }
} }