mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
Remove SharedPreferences, debug win
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -6,6 +6,7 @@ use cpal::{
|
||||
};
|
||||
use magnum_opus::{Channels::*, Decoder as AudioDecoder};
|
||||
use sha2::{Digest, Sha256};
|
||||
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
@@ -984,6 +985,32 @@ impl LoginConfigHandler {
|
||||
self.save_config(config);
|
||||
}
|
||||
|
||||
/// Set a ui config of flutter for handler's [`PeerConfig`].
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `k` - key of option
|
||||
/// * `v` - value of option
|
||||
pub fn set_ui_flutter(&mut self, k: String, v: String) {
|
||||
let mut config = self.load_config();
|
||||
config.ui_flutter.insert(k, v);
|
||||
self.save_config(config);
|
||||
}
|
||||
|
||||
/// Get a ui config of flutter for handler's [`PeerConfig`].
|
||||
/// Return String if the option is found, otherwise return "".
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `k` - key of option
|
||||
pub fn get_ui_flutter(&self, k: &str) -> String {
|
||||
if let Some(v) = self.config.ui_flutter.get(k) {
|
||||
v.clone()
|
||||
} else {
|
||||
"".to_owned()
|
||||
}
|
||||
}
|
||||
|
||||
/// Toggle an option in the handler.
|
||||
///
|
||||
/// # Arguments
|
||||
@@ -1947,6 +1974,7 @@ fn decode_id_pk(signed: &[u8], key: &sign::PublicKey) -> ResultType<(String, [u8
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
||||
pub fn disable_keyboard_listening() {
|
||||
crate::ui_session_interface::KEYBOARD_HOOKED.store(true, Ordering::SeqCst);
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ pub fn core_main() -> Option<Vec<String>> {
|
||||
hbb_common::allow_err!(crate::rc::extract_resources(&args[1]));
|
||||
return None;
|
||||
} else if args[0] == "--tray" {
|
||||
crate::tray::start_tray(crate::ui_interface::OPTIONS.clone());
|
||||
crate::tray::start_tray();
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,6 +227,7 @@ impl InvokeUiSession for FlutterHandler {
|
||||
id: i32,
|
||||
entries: &Vec<FileEntry>,
|
||||
path: String,
|
||||
#[allow(unused_variables)]
|
||||
is_local: bool,
|
||||
only_count: bool,
|
||||
) {
|
||||
|
||||
@@ -19,12 +19,12 @@ use crate::flutter::{self, SESSIONS};
|
||||
#[cfg(target_os = "android")]
|
||||
use crate::start_server;
|
||||
use crate::ui_interface::{self, *};
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
use crate::ui_session_interface::CUR_SESSION;
|
||||
use crate::{
|
||||
client::file_trait::FileManager,
|
||||
flutter::{make_fd_to_json, session_add, session_start_},
|
||||
};
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
use crate::ui_session_interface::CUR_SESSION;
|
||||
fn initialize(app_dir: &str) {
|
||||
*config::APP_DIR.write().unwrap() = app_dir.to_owned();
|
||||
#[cfg(target_os = "android")]
|
||||
@@ -162,6 +162,28 @@ pub fn session_toggle_option(id: String, value: String) {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn session_get_flutter_config(id: String, k: String) -> Option<String> {
|
||||
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
|
||||
Some(session.get_flutter_config(k))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn session_set_flutter_config(id: String, k: String, v: String) {
|
||||
if let Some(session) = SESSIONS.write().unwrap().get_mut(&id) {
|
||||
session.set_flutter_config(k, v);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_local_flutter_config(k: String) -> SyncReturn<String> {
|
||||
SyncReturn(ui_interface::get_local_flutter_config(k))
|
||||
}
|
||||
|
||||
pub fn set_local_flutter_config(k: String, v: String) {
|
||||
ui_interface::set_local_flutter_config(k, v);
|
||||
}
|
||||
|
||||
pub fn session_get_image_quality(id: String) -> Option<String> {
|
||||
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
|
||||
Some(session.get_image_quality())
|
||||
@@ -537,8 +559,8 @@ pub fn main_post_request(url: String, body: String, header: String) {
|
||||
post_request(url, body, header)
|
||||
}
|
||||
|
||||
pub fn main_get_local_option(key: String) -> String {
|
||||
get_local_option(key)
|
||||
pub fn main_get_local_option(key: String) -> SyncReturn<String> {
|
||||
SyncReturn(get_local_option(key))
|
||||
}
|
||||
|
||||
pub fn main_set_local_option(key: String, value: String) {
|
||||
@@ -1021,7 +1043,7 @@ pub fn main_is_installed() -> SyncReturn<bool> {
|
||||
SyncReturn(is_installed())
|
||||
}
|
||||
|
||||
pub fn main_start_grab_keyboard(){
|
||||
pub fn main_start_grab_keyboard() {
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
crate::ui_session_interface::global_grab_keyboard();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use super::HbbHttpResponse;
|
||||
use hbb_common::{
|
||||
config::{Config, LocalConfig},
|
||||
log, sleep, tokio, ResultType,
|
||||
log, ResultType,
|
||||
};
|
||||
use reqwest::blocking::Client;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
@@ -225,11 +225,7 @@ impl VideoQoS {
|
||||
}
|
||||
|
||||
pub fn check_abr_config(&mut self) -> bool {
|
||||
self.enable_abr = if let Some(v) = Config2::get().options.get("enable-abr") {
|
||||
v != "N"
|
||||
} else {
|
||||
true // default is true
|
||||
};
|
||||
self.enable_abr = "N" != Config::get_option("enable-abr");
|
||||
self.enable_abr
|
||||
}
|
||||
|
||||
|
||||
18
src/tray.rs
18
src/tray.rs
@@ -1,14 +1,13 @@
|
||||
use hbb_common::log::debug;
|
||||
use super::ui_interface::get_option_opt;
|
||||
#[cfg(target_os = "linux")]
|
||||
use hbb_common::log::{error, info};
|
||||
use hbb_common::log::{debug, error, info};
|
||||
#[cfg(target_os = "linux")]
|
||||
use libappindicator::AppIndicator;
|
||||
#[cfg(target_os = "linux")]
|
||||
use std::collections::HashMap;
|
||||
#[cfg(target_os = "linux")]
|
||||
use std::env::temp_dir;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
use std::sync::{Arc, Mutex};
|
||||
#[cfg(target_os = "windows")]
|
||||
use trayicon::{MenuBuilder, TrayIconBuilder};
|
||||
#[cfg(target_os = "windows")]
|
||||
@@ -25,7 +24,7 @@ enum Events {
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
pub fn start_tray(options: Arc<Mutex<HashMap<String, String>>>) {
|
||||
pub fn start_tray() {
|
||||
let event_loop = EventLoop::<Events>::with_user_event();
|
||||
let proxy = event_loop.create_proxy();
|
||||
let icon = include_bytes!("../res/tray-icon.ico");
|
||||
@@ -39,13 +38,13 @@ pub fn start_tray(options: Arc<Mutex<HashMap<String, String>>>) {
|
||||
let old_state = Arc::new(Mutex::new(0));
|
||||
let _sender = crate::ui_interface::SENDER.lock().unwrap();
|
||||
event_loop.run(move |event, _, control_flow| {
|
||||
if options.lock().unwrap().get("ipc-closed").is_some() {
|
||||
if get_option_opt("ipc-closed").is_some() {
|
||||
*control_flow = ControlFlow::Exit;
|
||||
return;
|
||||
} else {
|
||||
*control_flow = ControlFlow::Wait;
|
||||
}
|
||||
let stopped = if let Some(v) = options.lock().unwrap().get("stop-service") {
|
||||
let stopped = if let Some(v) = get_option_opt("stop-service") {
|
||||
!v.is_empty()
|
||||
} else {
|
||||
false
|
||||
@@ -173,6 +172,7 @@ fn get_default_app_indicator() -> Option<AppIndicator> {
|
||||
|
||||
/// Get service status
|
||||
/// Return [`true`] if service is running, [`false`] otherwise.
|
||||
#[cfg(target_os = "linux")]
|
||||
#[inline]
|
||||
fn get_service_status(options: Arc<Mutex<HashMap<String, String>>>) -> bool {
|
||||
if let Some(v) = options.lock().unwrap().get("stop-service") {
|
||||
|
||||
12
src/ui.rs
12
src/ui.rs
@@ -33,7 +33,8 @@ pub mod win_privacy;
|
||||
|
||||
type Message = RendezvousMessage;
|
||||
|
||||
pub type Childs = Arc<Mutex<(bool, HashMap<(String, String), Child>)>>;
|
||||
pub type Children = Arc<Mutex<(bool, HashMap<(String, String), Child>)>>;
|
||||
#[allow(dead_code)]
|
||||
type Status = (i32, bool, i64, String);
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
@@ -43,6 +44,7 @@ lazy_static::lazy_static! {
|
||||
|
||||
struct UIHostHandler;
|
||||
|
||||
// to-do: dead code?
|
||||
fn check_connect_status(
|
||||
reconnect: bool,
|
||||
) -> (
|
||||
@@ -111,8 +113,8 @@ pub fn start(args: &mut [String]) {
|
||||
args[1] = id;
|
||||
}
|
||||
if args.is_empty() {
|
||||
let child: Childs = Default::default();
|
||||
std::thread::spawn(move || check_zombie(child));
|
||||
let children: Children = Default::default();
|
||||
std::thread::spawn(move || check_zombie(children));
|
||||
crate::common::check_software_update();
|
||||
frame.event_handler(UI {});
|
||||
frame.sciter_handler(UIHostHandler {});
|
||||
@@ -662,10 +664,10 @@ impl sciter::host::HostHandler for UIHostHandler {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn check_zombie(childs: Childs) {
|
||||
pub fn check_zombie(children: Children) {
|
||||
let mut deads = Vec::new();
|
||||
loop {
|
||||
let mut lock = childs.lock().unwrap();
|
||||
let mut lock = children.lock().unwrap();
|
||||
let mut n = 0;
|
||||
for (id, c) in lock.1.iter_mut() {
|
||||
if let Ok(Some(_)) = c.try_wait() {
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
use std::sync::Arc;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
iter::FromIterator,
|
||||
ops::{Deref, DerefMut},
|
||||
sync::{
|
||||
atomic::{AtomicI64, Ordering},
|
||||
RwLock,
|
||||
},
|
||||
};
|
||||
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
||||
use std::iter::FromIterator;
|
||||
|
||||
#[cfg(windows)]
|
||||
use clipboard::{cliprdr::CliprdrClientContext, empty_clipboard, set_conn_enabled, ContextSend};
|
||||
|
||||
@@ -9,32 +9,37 @@ use std::{
|
||||
use hbb_common::password_security;
|
||||
use hbb_common::{
|
||||
allow_err,
|
||||
config::{self, Config, LocalConfig, PeerConfig, RENDEZVOUS_PORT, RENDEZVOUS_TIMEOUT},
|
||||
directories_next,
|
||||
futures::future::join_all,
|
||||
log,
|
||||
protobuf::Message as _,
|
||||
rendezvous_proto::*,
|
||||
config::{self, Config, LocalConfig, PeerConfig},
|
||||
directories_next, log,
|
||||
sleep,
|
||||
tcp::FramedStream,
|
||||
tokio::{self, sync::mpsc, time},
|
||||
};
|
||||
|
||||
use crate::{common::SOFTWARE_UPDATE_URL, ipc, platform};
|
||||
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
||||
use hbb_common::{
|
||||
config::{RENDEZVOUS_PORT, RENDEZVOUS_TIMEOUT},
|
||||
futures::future::join_all,
|
||||
protobuf::Message as _,
|
||||
rendezvous_proto::*,
|
||||
tcp::FramedStream,
|
||||
};
|
||||
|
||||
#[cfg(feature = "flutter")]
|
||||
use crate::hbbs_http::account;
|
||||
use crate::{common::SOFTWARE_UPDATE_URL, ipc, platform};
|
||||
|
||||
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
||||
type Message = RendezvousMessage;
|
||||
|
||||
pub type Childs = Arc<Mutex<(bool, HashMap<(String, String), Child>)>>;
|
||||
pub type Children = Arc<Mutex<(bool, HashMap<(String, String), Child>)>>;
|
||||
type Status = (i32, bool, i64, String); // (status_num, key_confirmed, mouse_time, id)
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref CHILDS : Childs = Default::default();
|
||||
pub static ref UI_STATUS : Arc<Mutex<Status>> = Arc::new(Mutex::new((0, false, 0, "".to_owned())));
|
||||
pub static ref OPTIONS : Arc<Mutex<HashMap<String, String>>> = Arc::new(Mutex::new(Config::get_options()));
|
||||
pub static ref ASYNC_JOB_STATUS : Arc<Mutex<String>> = Default::default();
|
||||
pub static ref TEMPORARY_PASSWD : Arc<Mutex<String>> = Arc::new(Mutex::new("".to_owned()));
|
||||
static ref CHILDREN : Children = Default::default();
|
||||
static ref UI_STATUS : Arc<Mutex<Status>> = Arc::new(Mutex::new((0, false, 0, "".to_owned())));
|
||||
static ref OPTIONS : Arc<Mutex<HashMap<String, String>>> = Arc::new(Mutex::new(Config::get_options()));
|
||||
static ref ASYNC_JOB_STATUS : Arc<Mutex<String>> = Default::default();
|
||||
static ref TEMPORARY_PASSWD : Arc<Mutex<String>> = Arc::new(Mutex::new("".to_owned()));
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
@@ -44,15 +49,16 @@ lazy_static::lazy_static! {
|
||||
|
||||
#[inline]
|
||||
pub fn recent_sessions_updated() -> bool {
|
||||
let mut childs = CHILDS.lock().unwrap();
|
||||
if childs.0 {
|
||||
childs.0 = false;
|
||||
let mut children = CHILDREN.lock().unwrap();
|
||||
if children.0 {
|
||||
children.0 = false;
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
||||
#[inline]
|
||||
pub fn get_id() -> String {
|
||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||
@@ -143,10 +149,9 @@ pub fn get_license() -> String {
|
||||
#[cfg(windows)]
|
||||
if let Some(lic) = crate::platform::windows::get_license() {
|
||||
#[cfg(feature = "flutter")]
|
||||
{
|
||||
return format!("Key: {}\nHost: {}\nApi: {}", lic.key, lic.host, lic.api);
|
||||
}
|
||||
return format!("Key: {}\nHost: {}\nApi: {}", lic.key, lic.host, lic.api);
|
||||
// default license format is html formed (sciter)
|
||||
#[cfg(not(feature = "flutter"))]
|
||||
return format!(
|
||||
"<br /> Key: {} <br /> Host: {} Api: {}",
|
||||
lic.key, lic.host, lic.api
|
||||
@@ -155,6 +160,11 @@ pub fn get_license() -> String {
|
||||
Default::default()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_option_opt(key: &str) -> Option<String> {
|
||||
OPTIONS.lock().unwrap().get(key).map(|x| x.clone())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_option(key: String) -> String {
|
||||
get_option_(&key)
|
||||
@@ -180,6 +190,16 @@ pub fn set_local_option(key: String, value: String) {
|
||||
LocalConfig::set_option(key, value);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_local_flutter_config(key: String) -> String {
|
||||
LocalConfig::get_flutter_config(&key)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set_local_flutter_config(key: String, value: String) {
|
||||
LocalConfig::set_flutter_config(key, value);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn peer_has_password(id: String) -> bool {
|
||||
!PeerConfig::load(&id).password.is_empty()
|
||||
@@ -230,7 +250,7 @@ pub fn test_if_valid_server(host: String) -> String {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
#[cfg(feature = "flutter")]
|
||||
pub fn get_sound_inputs() -> Vec<String> {
|
||||
let mut a = Vec::new();
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
@@ -345,12 +365,15 @@ pub fn set_socks(proxy: String, username: String, password: String) {
|
||||
.ok();
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
#[inline]
|
||||
pub fn is_installed() -> bool {
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
{
|
||||
return crate::platform::is_installed();
|
||||
}
|
||||
crate::platform::is_installed()
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||
#[inline]
|
||||
pub fn is_installed() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
@@ -495,7 +518,7 @@ pub fn remove_peer(id: String) {
|
||||
|
||||
#[inline]
|
||||
pub fn new_remote(id: String, remote_type: String) {
|
||||
let mut lock = CHILDS.lock().unwrap();
|
||||
let mut lock = CHILDREN.lock().unwrap();
|
||||
let args = vec![format!("--{}", remote_type), id.clone()];
|
||||
let key = (id.clone(), remote_type.clone());
|
||||
if let Some(c) = lock.1.get_mut(&key) {
|
||||
@@ -612,6 +635,7 @@ pub fn get_version() -> String {
|
||||
crate::VERSION.to_owned()
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
||||
#[inline]
|
||||
pub fn get_app_name() -> String {
|
||||
crate::get_app_name()
|
||||
@@ -650,6 +674,7 @@ pub fn create_shortcut(_id: String) {
|
||||
crate::platform::windows::create_shortcut(&_id).ok();
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
||||
#[inline]
|
||||
pub fn discover() {
|
||||
std::thread::spawn(move || {
|
||||
@@ -694,6 +719,7 @@ pub fn open_url(url: String) {
|
||||
allow_err!(std::process::Command::new(p).arg(url).spawn());
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
||||
#[inline]
|
||||
pub fn change_id(id: String) {
|
||||
*ASYNC_JOB_STATUS.lock().unwrap() = " ".to_owned();
|
||||
@@ -800,13 +826,19 @@ pub fn is_release() -> bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
#[inline]
|
||||
pub fn is_root() -> bool {
|
||||
crate::platform::is_root()
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||
#[inline]
|
||||
pub fn is_root() -> bool {
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
return crate::platform::is_root();
|
||||
false
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
||||
#[inline]
|
||||
pub fn check_super_user_permission() -> bool {
|
||||
#[cfg(feature = "flatpak")]
|
||||
@@ -818,10 +850,10 @@ pub fn check_super_user_permission() -> bool {
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn check_zombie(childs: Childs) {
|
||||
pub fn check_zombie(children: Children) {
|
||||
let mut deads = Vec::new();
|
||||
loop {
|
||||
let mut lock = childs.lock().unwrap();
|
||||
let mut lock = children.lock().unwrap();
|
||||
let mut n = 0;
|
||||
for (id, c) in lock.1.iter_mut() {
|
||||
if let Ok(Some(_)) = c.try_wait() {
|
||||
@@ -928,6 +960,7 @@ pub(crate) async fn check_connect_status_(reconnect: bool, rx: mpsc::UnboundedRe
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
pub(crate) async fn send_to_cm(data: &ipc::Data) {
|
||||
if let Ok(mut c) = ipc::connect(1000, "_cm").await {
|
||||
@@ -935,9 +968,12 @@ pub(crate) async fn send_to_cm(data: &ipc::Data) {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
||||
const INVALID_FORMAT: &'static str = "Invalid format";
|
||||
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
||||
const UNKNOWN_ERROR: &'static str = "Unknown error";
|
||||
|
||||
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn change_id_(id: String, old_id: String) -> &'static str {
|
||||
if !hbb_common::is_valid_custom_id(&id) {
|
||||
@@ -987,6 +1023,7 @@ async fn change_id_(id: String, old_id: String) -> &'static str {
|
||||
err
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "android", target_os = "ios", feature = "flutter"))]
|
||||
async fn check_id(
|
||||
rendezvous_server: String,
|
||||
old_id: String,
|
||||
|
||||
@@ -98,6 +98,14 @@ impl<T: InvokeUiSession> Session<T> {
|
||||
self.lc.write().unwrap().save_view_style(value);
|
||||
}
|
||||
|
||||
pub fn set_flutter_config(&mut self, k: String, v: String) {
|
||||
self.lc.write().unwrap().set_ui_flutter(k, v);
|
||||
}
|
||||
|
||||
pub fn get_flutter_config(&self, k: String) -> String {
|
||||
self.lc.write().unwrap().get_ui_flutter(&k)
|
||||
}
|
||||
|
||||
pub fn toggle_option(&mut self, name: String) {
|
||||
let msg = self.lc.write().unwrap().toggle_option(name.clone());
|
||||
if name == "enable-file-transfer" {
|
||||
@@ -1590,7 +1598,7 @@ pub fn global_grab_keyboard() {
|
||||
#[cfg(any(target_os = "windows", target_os = "macos"))]
|
||||
std::thread::spawn(move || {
|
||||
let func = move |event: Event| match event.event_type {
|
||||
EventType::KeyPress(key) | EventType::KeyRelease(key) => {
|
||||
EventType::KeyPress(..) | EventType::KeyRelease(..) => {
|
||||
// grab all keys
|
||||
if !IS_IN.load(Ordering::SeqCst) {
|
||||
return Some(event);
|
||||
|
||||
Reference in New Issue
Block a user