diff --git a/src/client.rs b/src/client.rs index 8f6cb12bb..25061bcfe 100644 --- a/src/client.rs +++ b/src/client.rs @@ -11,7 +11,6 @@ use cpal::{ traits::{DeviceTrait, HostTrait, StreamTrait}, Device, Host, StreamConfig, }; -use enigo::{Enigo, KeyboardControllable}; use magnum_opus::{Channels::*, Decoder as AudioDecoder}; use sha2::{Digest, Sha256}; use uuid::Uuid; @@ -38,7 +37,6 @@ use hbb_common::{ }; pub use helper::LatencyController; pub use helper::*; -use scrap::Image; use scrap::{ codec::{Decoder, DecoderCfg}, VpxDecoderConfig, VpxVideoCodecId, @@ -61,14 +59,17 @@ pub struct Client; #[cfg(not(any(target_os = "android", target_os = "linux")))] lazy_static::lazy_static! { -static ref AUDIO_HOST: Host = cpal::default_host(); + static ref AUDIO_HOST: Host = cpal::default_host(); } +#[cfg(not(any(target_os = "android", target_os = "ios")))] lazy_static::lazy_static! { - static ref ENIGO: Arc> = Arc::new(Mutex::new(Enigo::new())); + static ref ENIGO: Arc> = Arc::new(Mutex::new(enigo::Enigo::new())); } +#[cfg(not(any(target_os = "android", target_os = "ios")))] pub fn get_key_state(key: enigo::Key) -> bool { + use enigo::KeyboardControllable; #[cfg(target_os = "macos")] if key == enigo::Key::NumLock { return true; diff --git a/src/client/io_loop.rs b/src/client/io_loop.rs index f7f8f4f18..e61690c32 100644 --- a/src/client/io_loop.rs +++ b/src/client/io_loop.rs @@ -2,6 +2,7 @@ use crate::client::{ Client, CodecFormat, FileManager, MediaData, MediaSender, QualityStatus, MILLI1, SEC30, SERVER_CLIPBOARD_ENABLED, SERVER_FILE_TRANSFER_ENABLED, SERVER_KEYBOARD_ENABLED, }; +#[cfg(not(any(target_os = "android", target_os = "ios")))] use crate::common::{check_clipboard, update_clipboard, ClipboardContext, CLIPBOARD_INTERVAL}; use crate::ui_session_interface::{InvokeUi, Session}; @@ -235,6 +236,7 @@ impl Remote { let old_clipboard = self.old_clipboard.clone(); let tx_protobuf = self.sender.clone(); let lc = self.handler.lc.clone(); + #[cfg(not(any(target_os = "android", target_os = "ios")))] match ClipboardContext::new() { Ok(mut ctx) => { // ignore clipboard update before service start @@ -266,6 +268,7 @@ impl Remote { Some(tx) } + // TODO fn load_last_jobs(&mut self) { log::info!("start load last jobs"); self.handler.clear_all_jobs(); diff --git a/src/ui_session_interface.rs b/src/ui_session_interface.rs index c08cc09ce..d89ce2d3b 100644 --- a/src/ui_session_interface.rs +++ b/src/ui_session_interface.rs @@ -1,11 +1,12 @@ use crate::client::io_loop::Remote; use crate::client::{ - check_if_retry, get_key_state, handle_hash, handle_login_from_ui, handle_test_delay, + check_if_retry, handle_hash, handle_login_from_ui, handle_test_delay, input_os_password, load_config, send_mouse, start_video_audio_threads, FileManager, Key, LoginConfigHandler, QualityStatus, KEY_MAP, SERVER_KEYBOARD_ENABLED, }; +#[cfg(not(any(target_os = "android", target_os = "ios")))] +use crate::client::get_key_state; use crate::common; - use crate::{client::Data, client::Interface}; use async_trait::async_trait; @@ -129,6 +130,7 @@ impl Session { self.send(Data::Message(msg)); } + #[cfg(not(any(target_os = "android", target_os = "ios")))] pub fn t(&self, name: String) -> String { crate::client::translate(name) } @@ -271,9 +273,11 @@ impl Session { { key_event.modifiers.push(ControlKey::Meta.into()); } + #[cfg(not(any(target_os = "android", target_os = "ios")))] if get_key_state(enigo::Key::CapsLock) { key_event.modifiers.push(ControlKey::CapsLock.into()); } + #[cfg(not(any(target_os = "android", target_os = "ios")))] if self.peer_platform() != "Mac OS" { if get_key_state(enigo::Key::NumLock) && common::valid_for_numlock(&key_event) { key_event.modifiers.push(ControlKey::NumLock.into()); @@ -318,6 +322,7 @@ impl Session { return "".to_owned(); } + #[cfg(not(any(target_os = "android", target_os = "ios")))] pub fn get_icon(&self) -> String { crate::get_icon() } @@ -661,6 +666,7 @@ impl Interface for Session { } } // TODO use event callbcak + #[cfg(not(any(target_os = "android", target_os = "ios")))] self.start_keyboard_hook(); } @@ -704,6 +710,7 @@ impl Interface for Session { // TODO use event callbcak // sciter only +#[cfg(not(any(target_os = "android", target_os = "ios")))] impl Session { fn start_keyboard_hook(&self) { if self.is_port_forward() || self.is_file_transfer() { @@ -948,6 +955,7 @@ pub async fn io_loop(handler: Session) { if key.is_empty() { key = crate::platform::get_license_key(); } + #[cfg(not(any(target_os = "android", target_os = "ios")))] if handler.is_port_forward() { if handler.is_rdp() { let port = handler @@ -1053,6 +1061,7 @@ pub async fn io_loop(handler: Session) { remote.sync_jobs_status_to_local().await; } +#[cfg(not(any(target_os = "android", target_os = "ios")))] async fn start_one_port_forward( handler: Session, port: i32,