correct conditional compilation

This commit is contained in:
Ferdinand Schober
2024-07-01 12:13:27 +02:00
parent 08f24293f8
commit b1d9180cca
2 changed files with 8 additions and 3 deletions

View File

@@ -37,9 +37,7 @@ pub async fn create(
if let Some(backend) = backend {
return match backend {
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
CaptureBackend::InputCapturePortal => {
Ok(Box::new(libei::LibeiInputCapture::new().await?))
}
CaptureBackend::InputCapturePortal => Ok(Box::new(libei::LibeiInputCapture::new().await?)),
#[cfg(all(unix, feature = "wayland", not(target_os = "macos")))]
CaptureBackend::LayerShell => Ok(Box::new(wayland::WaylandInputCapture::new()?)),
#[cfg(all(unix, feature = "x11", not(target_os = "macos")))]

View File

@@ -50,8 +50,15 @@ pub async fn create(
) -> Result<Box<dyn InputEmulation>, EmulationCreationError> {
if let Some(backend) = backend {
return match backend {
#[cfg(windows)]
EmulationBackend::Windows => Ok(Box::new(windows::WindowsEmulation::new()?)),
#[cfg(target_os = "macos")]
EmulationBackend::MacOs => Ok(Box::new(windows::MacOSEmulation::new()?)),
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
EmulationBackend::Libei => Ok(Box::new(libei::LibeiEmulation::new().await?)),
#[cfg(all(unix, feature = "wayland", not(target_os = "macos")))]
EmulationBackend::Wlroots => Ok(Box::new(wlroots::WlrootsEmulation::new()?)),
#[cfg(all(unix, feature = "x11", not(target_os = "macos")))]
EmulationBackend::X11 => Ok(Box::new(x11::X11Emulation::new()?)),
EmulationBackend::Dummy => Ok(Box::new(dummy::DummyEmulation::new())),
};