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