From f74b7f98fe7280bc52355c6f3d08098b2e11c91c Mon Sep 17 00:00:00 2001 From: Ferdinand Schober Date: Fri, 12 Jul 2024 18:18:46 +0200 Subject: [PATCH] fix conditional compilation --- input-capture/src/error.rs | 8 +++++++- input-capture/src/macos.rs | 2 +- input-emulation/src/error.rs | 6 ++++++ input-emulation/src/macos.rs | 2 ++ input-emulation/src/windows.rs | 2 ++ input-event/Cargo.toml | 2 ++ input-event/src/lib.rs | 2 +- 7 files changed, 21 insertions(+), 3 deletions(-) diff --git a/input-capture/src/error.rs b/input-capture/src/error.rs index 9264beb..2541649 100644 --- a/input-capture/src/error.rs +++ b/input-capture/src/error.rs @@ -1,4 +1,3 @@ -use ashpd::desktop::ResponseError; use thiserror::Error; #[cfg(all(unix, feature = "wayland", not(target_os = "macos")))] @@ -10,6 +9,8 @@ use wayland_client::{ ConnectError, DispatchError, }; +#[cfg(all(unix, feature = "libei", not(target_os = "macos")))] +use ashpd::desktop::ResponseError; #[cfg(all(unix, feature = "libei", not(target_os = "macos")))] use reis::tokio::{EiConvertEventStreamError, HandshakeError}; @@ -72,6 +73,7 @@ pub enum CaptureCreationError { impl CaptureCreationError { /// request was intentionally denied by the user + #[cfg(all(unix, feature = "libei", not(target_os = "macos")))] pub(crate) fn cancelled_by_user(&self) -> bool { matches!( self, @@ -80,6 +82,10 @@ impl CaptureCreationError { ))) ) } + #[cfg(not(all(unix, feature = "libei", not(target_os = "macos"))))] + pub(crate) fn cancelled_by_user(&self) -> bool { + false + } } #[cfg(all(unix, feature = "libei", not(target_os = "macos")))] diff --git a/input-capture/src/macos.rs b/input-capture/src/macos.rs index e2909a3..fb899a2 100644 --- a/input-capture/src/macos.rs +++ b/input-capture/src/macos.rs @@ -4,8 +4,8 @@ use crate::{ use async_trait::async_trait; use futures_core::Stream; use input_event::Event; +use std::pin::Pin; use std::task::{Context, Poll}; -use std::{io, pin::Pin}; pub struct MacOSInputCapture; diff --git a/input-emulation/src/error.rs b/input-emulation/src/error.rs index 368a49e..3fd8ca4 100644 --- a/input-emulation/src/error.rs +++ b/input-emulation/src/error.rs @@ -1,3 +1,4 @@ +#[cfg(all(unix, feature = "libei", not(target_os = "macos")))] use ashpd::{desktop::ResponseError, Error::Response}; #[cfg(all(unix, feature = "libei", not(target_os = "macos")))] use reis::tokio::EiConvertEventStreamError; @@ -78,6 +79,7 @@ pub enum EmulationCreationError { impl EmulationCreationError { /// request was intentionally denied by the user + #[cfg(all(unix, feature = "libei", not(target_os = "macos")))] pub(crate) fn cancelled_by_user(&self) -> bool { matches!( self, @@ -88,6 +90,10 @@ impl EmulationCreationError { ))) ) } + #[cfg(not(all(unix, feature = "libei", not(target_os = "macos"))))] + pub(crate) fn cancelled_by_user(&self) -> bool { + false + } } #[cfg(all(unix, feature = "wayland", not(target_os = "macos")))] diff --git a/input-emulation/src/macos.rs b/input-emulation/src/macos.rs index 392aec1..e59c4bb 100644 --- a/input-emulation/src/macos.rs +++ b/input-emulation/src/macos.rs @@ -295,4 +295,6 @@ impl InputEmulation for MacOSEmulation { async fn create(&mut self, _handle: EmulationHandle) {} async fn destroy(&mut self, _handle: EmulationHandle) {} + + async fn terminate(&mut self) {} } diff --git a/input-emulation/src/windows.rs b/input-emulation/src/windows.rs index 3276769..3bf86d8 100644 --- a/input-emulation/src/windows.rs +++ b/input-emulation/src/windows.rs @@ -80,6 +80,8 @@ impl InputEmulation for WindowsEmulation { async fn create(&mut self, _handle: EmulationHandle) {} async fn destroy(&mut self, _handle: EmulationHandle) {} + + async fn terminate(&mut self) {} } impl WindowsEmulation { diff --git a/input-event/Cargo.toml b/input-event/Cargo.toml index 8b9285d..c392c6a 100644 --- a/input-event/Cargo.toml +++ b/input-event/Cargo.toml @@ -12,6 +12,8 @@ log = "0.4.22" num_enum = "0.7.2" serde = { version = "1.0", features = ["derive"] } thiserror = "1.0.61" + +[target.'cfg(all(unix, not(target_os="macos")))'.dependencies] reis = { version = "0.2.0", optional = true } [features] diff --git a/input-event/src/lib.rs b/input-event/src/lib.rs index 240b0f2..c5c5bf6 100644 --- a/input-event/src/lib.rs +++ b/input-event/src/lib.rs @@ -5,7 +5,7 @@ pub mod error; pub mod proto; pub mod scancode; -#[cfg(feature = "libei")] +#[cfg(all(unix, feature = "libei", not(target_os = "macos")))] mod libei; // FIXME