remove warns

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2023-04-20 13:36:44 +08:00
parent 64689c8fd7
commit a76fd86f19
3 changed files with 25 additions and 11 deletions

View File

@ -165,6 +165,7 @@ impl OboePlayer {
} }
} }
#[cfg(not(any(target_os = "android", target_os = "ios")))]
fn is_null(&self) -> bool { fn is_null(&self) -> bool {
self.raw.is_null() self.raw.is_null()
} }

View File

@ -1,6 +1,3 @@
#[cfg(not(any(target_os = "android", target_os = "ios")))]
use crate::client::get_key_state;
use crate::common::GrabState;
#[cfg(feature = "flutter")] #[cfg(feature = "flutter")]
use crate::flutter::{CUR_SESSION_ID, SESSIONS}; use crate::flutter::{CUR_SESSION_ID, SESSIONS};
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
@ -8,6 +5,8 @@ use crate::platform::windows::{get_char_from_vk, get_unicode_from_vk};
#[cfg(not(any(feature = "flutter", feature = "cli")))] #[cfg(not(any(feature = "flutter", feature = "cli")))]
use crate::ui::CUR_SESSION; use crate::ui::CUR_SESSION;
#[cfg(not(any(target_os = "android", target_os = "ios")))] #[cfg(not(any(target_os = "android", target_os = "ios")))]
use crate::{client::get_key_state, common::GrabState};
#[cfg(not(any(target_os = "android", target_os = "ios")))]
use hbb_common::log; use hbb_common::log;
use hbb_common::message_proto::*; use hbb_common::message_proto::*;
#[cfg(any(target_os = "windows", target_os = "macos"))] #[cfg(any(target_os = "windows", target_os = "macos"))]
@ -15,10 +14,11 @@ use rdev::KeyCode;
use rdev::{Event, EventType, Key}; use rdev::{Event, EventType, Key};
#[cfg(any(target_os = "windows", target_os = "macos"))] #[cfg(any(target_os = "windows", target_os = "macos"))]
use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::atomic::{AtomicBool, Ordering};
#[cfg(not(any(target_os = "android", target_os = "ios")))]
use std::time::SystemTime;
use std::{ use std::{
collections::{HashMap, HashSet}, collections::{HashMap, HashSet},
sync::{Arc, Mutex}, sync::{Arc, Mutex},
time::SystemTime,
}; };
#[cfg(windows)] #[cfg(windows)]
@ -73,6 +73,7 @@ pub mod client {
super::start_grab_loop(); super::start_grab_loop();
} }
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn change_grab_status(state: GrabState) { pub fn change_grab_status(state: GrabState) {
match state { match state {
GrabState::Ready => {} GrabState::Ready => {}
@ -320,6 +321,7 @@ pub fn is_long_press(event: &Event) -> bool {
return false; return false;
} }
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn release_remote_keys() { pub fn release_remote_keys() {
// todo!: client quit suddenly, how to release keys? // todo!: client quit suddenly, how to release keys?
let to_release = TO_RELEASE.lock().unwrap().clone(); let to_release = TO_RELEASE.lock().unwrap().clone();
@ -565,6 +567,7 @@ pub fn event_to_key_events(
key_events key_events
} }
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn event_type_to_event(event_type: EventType) -> Event { pub fn event_type_to_event(event_type: EventType) -> Event {
Event { Event {
event_type, event_type,

View File

@ -1,12 +1,14 @@
#[cfg(not(any(target_os = "android", target_os = "ios")))] #[cfg(not(any(target_os = "android", target_os = "ios")))]
use std::collections::HashMap; use std::{collections::HashMap, sync::atomic::AtomicBool};
use std::ops::{Deref, DerefMut}; use std::{
use std::str::FromStr; ops::{Deref, DerefMut},
use std::sync::{ str::FromStr,
atomic::{AtomicBool, AtomicUsize, Ordering}, sync::{
Arc, Mutex, RwLock, atomic::{AtomicUsize, Ordering},
Arc, Mutex, RwLock,
},
time::{Duration, SystemTime},
}; };
use std::time::{Duration, SystemTime};
use async_trait::async_trait; use async_trait::async_trait;
use bytes::Bytes; use bytes::Bytes;
@ -27,10 +29,12 @@ use crate::client::{
input_os_password, load_config, send_mouse, start_video_audio_threads, FileManager, Key, input_os_password, load_config, send_mouse, start_video_audio_threads, FileManager, Key,
LoginConfigHandler, QualityStatus, KEY_MAP, LoginConfigHandler, QualityStatus, KEY_MAP,
}; };
#[cfg(not(any(target_os = "android", target_os = "ios")))]
use crate::common::GrabState; use crate::common::GrabState;
use crate::keyboard; use crate::keyboard;
use crate::{client::Data, client::Interface}; use crate::{client::Data, client::Interface};
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub static IS_IN: AtomicBool = AtomicBool::new(false); pub static IS_IN: AtomicBool = AtomicBool::new(false);
#[derive(Clone, Default)] #[derive(Clone, Default)]
@ -55,6 +59,7 @@ pub struct SessionPermissionConfig {
pub server_clipboard_enabled: Arc<RwLock<bool>>, pub server_clipboard_enabled: Arc<RwLock<bool>>,
} }
#[cfg(not(any(target_os = "android", target_os = "ios")))]
impl SessionPermissionConfig { impl SessionPermissionConfig {
pub fn is_text_clipboard_required(&self) -> bool { pub fn is_text_clipboard_required(&self) -> bool {
*self.server_clipboard_enabled.read().unwrap() *self.server_clipboard_enabled.read().unwrap()
@ -64,6 +69,7 @@ impl SessionPermissionConfig {
} }
impl<T: InvokeUiSession> Session<T> { impl<T: InvokeUiSession> Session<T> {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn get_permission_config(&self) -> SessionPermissionConfig { pub fn get_permission_config(&self) -> SessionPermissionConfig {
SessionPermissionConfig { SessionPermissionConfig {
lc: self.lc.clone(), lc: self.lc.clone(),
@ -89,6 +95,7 @@ impl<T: InvokeUiSession> Session<T> {
.eq(&ConnType::PORT_FORWARD) .eq(&ConnType::PORT_FORWARD)
} }
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn is_rdp(&self) -> bool { pub fn is_rdp(&self) -> bool {
self.lc.read().unwrap().conn_type.eq(&ConnType::RDP) self.lc.read().unwrap().conn_type.eq(&ConnType::RDP)
} }
@ -162,6 +169,7 @@ impl<T: InvokeUiSession> Session<T> {
self.lc.read().unwrap().is_privacy_mode_supported() self.lc.read().unwrap().is_privacy_mode_supported()
} }
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn is_text_clipboard_required(&self) -> bool { pub fn is_text_clipboard_required(&self) -> bool {
*self.server_clipboard_enabled.read().unwrap() *self.server_clipboard_enabled.read().unwrap()
&& *self.server_keyboard_enabled.read().unwrap() && *self.server_keyboard_enabled.read().unwrap()
@ -488,6 +496,7 @@ impl<T: InvokeUiSession> Session<T> {
self.send(Data::Message(msg_out)); self.send(Data::Message(msg_out));
} }
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn enter(&self) { pub fn enter(&self) {
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
{ {
@ -502,6 +511,7 @@ impl<T: InvokeUiSession> Session<T> {
keyboard::client::change_grab_status(GrabState::Run); keyboard::client::change_grab_status(GrabState::Run);
} }
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn leave(&self) { pub fn leave(&self) {
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
{ {