This commit is contained in:
Ferdinand Schober
2024-07-01 17:03:53 +02:00
parent 1599e6e76a
commit 3c2f9da5b7
4 changed files with 6 additions and 6 deletions

View File

@@ -33,7 +33,7 @@ pub mod dummy;
pub async fn create_backend(
backend: CaptureBackend,
) -> Result<Box<dyn InputCapture<Item = io::Result<(ClientHandle, Event)>>>, CaptureCreationError> {
return match backend {
match backend {
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
CaptureBackend::InputCapturePortal => Ok(Box::new(libei::LibeiInputCapture::new().await?)),
#[cfg(all(unix, feature = "wayland", not(target_os = "macos")))]
@@ -45,7 +45,7 @@ pub async fn create_backend(
#[cfg(target_os = "macos")]
CaptureBackend::MacOs => Ok(Box::new(macos::MacOSInputCapture::new()?)),
CaptureBackend::Dummy => Ok(Box::new(dummy::DummyInputCapture::new())),
};
}
}
pub async fn create(

View File

@@ -42,7 +42,7 @@ impl Display for CaptureCreationError {
CaptureCreationError::Macos(e) => format!("{e}"),
#[cfg(windows)]
CaptureCreationError::Windows => format!(""),
CaptureCreationError::NoAvailableBackend => format!("no available backend"),
CaptureCreationError::NoAvailableBackend => "no available backend".to_string(),
};
write!(f, "could not create input capture: {reason}")
}

View File

@@ -48,7 +48,7 @@ pub trait InputEmulation: Send {
pub async fn create_backend(
backend: EmulationBackend,
) -> Result<Box<dyn InputEmulation>, EmulationCreationError> {
return match backend {
match backend {
#[cfg(all(unix, feature = "wayland", not(target_os = "macos")))]
EmulationBackend::Wlroots => Ok(Box::new(wlroots::WlrootsEmulation::new()?)),
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
@@ -64,7 +64,7 @@ pub async fn create_backend(
#[cfg(target_os = "macos")]
EmulationBackend::MacOs => Ok(Box::new(macos::MacOSEmulation::new()?)),
EmulationBackend::Dummy => Ok(Box::new(dummy::DummyEmulation::new())),
};
}
}
pub async fn create(

View File

@@ -36,7 +36,7 @@ impl Display for EmulationCreationError {
EmulationCreationError::X11(e) => format!("x11 backend: {e}"),
#[cfg(target_os = "macos")]
EmulationCreationError::MacOs(e) => format!("macos backend: {e}"),
EmulationCreationError::NoAvailableBackend => format!("no backend available"),
EmulationCreationError::NoAvailableBackend => "no backend available".to_string(),
};
write!(f, "could not create input emulation backend: {reason}")
}