From db2004fd02f865acc584f7d091b690cd0d81b7a5 Mon Sep 17 00:00:00 2001 From: Ferdinand Schober Date: Mon, 1 Jul 2024 17:16:36 +0200 Subject: [PATCH] fix windows --- src/emulate/error.rs | 8 ++++++++ src/emulate/windows.rs | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/emulate/error.rs b/src/emulate/error.rs index 60f7c95..75d8d6e 100644 --- a/src/emulate/error.rs +++ b/src/emulate/error.rs @@ -20,6 +20,8 @@ pub enum EmulationCreationError { X11(#[from] X11EmulationCreationError), #[cfg(target_os = "macos")] MacOs(#[from] MacOSEmulationCreationError), + #[cfg(windows)] + Windows(#[from] WindowsEmulationCreationError), NoAvailableBackend, } @@ -36,6 +38,8 @@ impl Display for EmulationCreationError { EmulationCreationError::X11(e) => format!("x11 backend: {e}"), #[cfg(target_os = "macos")] EmulationCreationError::MacOs(e) => format!("macos backend: {e}"), + #[cfg(windows)] + EmulationCreationError::Windows(e) => format!("windows backend: {e}"), EmulationCreationError::NoAvailableBackend => "no backend available".to_string(), }; 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 {} diff --git a/src/emulate/windows.rs b/src/emulate/windows.rs index 7eeb5c5..a7f0f22 100644 --- a/src/emulate/windows.rs +++ b/src/emulate/windows.rs @@ -1,9 +1,9 @@ +use super::error::WindowsEmulationCreationError; use crate::{ emulate::InputEmulation, event::{KeyboardEvent, PointerEvent}, scancode, }; -use anyhow::Result; use async_trait::async_trait; use std::ops::BitOrAssign; use std::time::Duration; @@ -33,7 +33,7 @@ pub struct WindowsEmulation { } impl WindowsEmulation { - pub fn new() -> Result { + pub fn new() -> Result { Ok(Self { repeat_task: None }) } }