fix conditional compilation

This commit is contained in:
Ferdinand Schober
2024-07-12 18:18:46 +02:00
parent 7e77e0c3f5
commit f74b7f98fe
7 changed files with 21 additions and 3 deletions

View File

@@ -1,4 +1,3 @@
use ashpd::desktop::ResponseError;
use thiserror::Error; use thiserror::Error;
#[cfg(all(unix, feature = "wayland", not(target_os = "macos")))] #[cfg(all(unix, feature = "wayland", not(target_os = "macos")))]
@@ -10,6 +9,8 @@ use wayland_client::{
ConnectError, DispatchError, ConnectError, DispatchError,
}; };
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
use ashpd::desktop::ResponseError;
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))] #[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
use reis::tokio::{EiConvertEventStreamError, HandshakeError}; use reis::tokio::{EiConvertEventStreamError, HandshakeError};
@@ -72,6 +73,7 @@ pub enum CaptureCreationError {
impl CaptureCreationError { impl CaptureCreationError {
/// request was intentionally denied by the user /// request was intentionally denied by the user
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
pub(crate) fn cancelled_by_user(&self) -> bool { pub(crate) fn cancelled_by_user(&self) -> bool {
matches!( matches!(
self, 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")))] #[cfg(all(unix, feature = "libei", not(target_os = "macos")))]

View File

@@ -4,8 +4,8 @@ use crate::{
use async_trait::async_trait; use async_trait::async_trait;
use futures_core::Stream; use futures_core::Stream;
use input_event::Event; use input_event::Event;
use std::pin::Pin;
use std::task::{Context, Poll}; use std::task::{Context, Poll};
use std::{io, pin::Pin};
pub struct MacOSInputCapture; pub struct MacOSInputCapture;

View File

@@ -1,3 +1,4 @@
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
use ashpd::{desktop::ResponseError, Error::Response}; use ashpd::{desktop::ResponseError, Error::Response};
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))] #[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
use reis::tokio::EiConvertEventStreamError; use reis::tokio::EiConvertEventStreamError;
@@ -78,6 +79,7 @@ pub enum EmulationCreationError {
impl EmulationCreationError { impl EmulationCreationError {
/// request was intentionally denied by the user /// request was intentionally denied by the user
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
pub(crate) fn cancelled_by_user(&self) -> bool { pub(crate) fn cancelled_by_user(&self) -> bool {
matches!( matches!(
self, 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")))] #[cfg(all(unix, feature = "wayland", not(target_os = "macos")))]

View File

@@ -295,4 +295,6 @@ impl InputEmulation for MacOSEmulation {
async fn create(&mut self, _handle: EmulationHandle) {} async fn create(&mut self, _handle: EmulationHandle) {}
async fn destroy(&mut self, _handle: EmulationHandle) {} async fn destroy(&mut self, _handle: EmulationHandle) {}
async fn terminate(&mut self) {}
} }

View File

@@ -80,6 +80,8 @@ impl InputEmulation for WindowsEmulation {
async fn create(&mut self, _handle: EmulationHandle) {} async fn create(&mut self, _handle: EmulationHandle) {}
async fn destroy(&mut self, _handle: EmulationHandle) {} async fn destroy(&mut self, _handle: EmulationHandle) {}
async fn terminate(&mut self) {}
} }
impl WindowsEmulation { impl WindowsEmulation {

View File

@@ -12,6 +12,8 @@ log = "0.4.22"
num_enum = "0.7.2" num_enum = "0.7.2"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
thiserror = "1.0.61" thiserror = "1.0.61"
[target.'cfg(all(unix, not(target_os="macos")))'.dependencies]
reis = { version = "0.2.0", optional = true } reis = { version = "0.2.0", optional = true }
[features] [features]

View File

@@ -5,7 +5,7 @@ pub mod error;
pub mod proto; pub mod proto;
pub mod scancode; pub mod scancode;
#[cfg(feature = "libei")] #[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
mod libei; mod libei;
// FIXME // FIXME