fix cur session

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-01-20 21:03:30 +08:00
parent 30278d12d3
commit 3dcada128b
6 changed files with 68 additions and 47 deletions

View File

@@ -13,9 +13,9 @@ use hbb_common::{
log,
};
use crate::common::get_app_name;
use crate::ipc;
use crate::ui_interface::*;
#[cfg(not(any(feature = "flutter", feature = "cli")))]
use crate::ui_session_interface::Session;
use crate::{common::get_app_name, ipc, ui_interface::*};
mod cm;
#[cfg(feature = "inline")]
@@ -35,6 +35,11 @@ lazy_static::lazy_static! {
static ref STUPID_VALUES: Mutex<Vec<Arc<Vec<Value>>>> = Default::default();
}
#[cfg(not(any(feature = "flutter", feature = "cli")))]
lazy_static::lazy_static! {
pub static ref CUR_SESSION: Arc<Mutex<Option<Session<remote::SciterHandler>>>> = Default::default();
}
struct UIHostHandler;
pub fn start(args: &mut [String]) {
@@ -119,9 +124,10 @@ pub fn start(args: &mut [String]) {
frame.register_behavior("native-remote", move || {
let handler =
remote::SciterSession::new(cmd.clone(), id.clone(), pass.clone(), args.clone());
#[cfg(not(feature = "flutter"))]
crate::keyboard::set_cur_session(handler.inner());
#[cfg(not(any(feature = "flutter", feature = "cli")))]
{
*CUR_SESSION.lock().unwrap() = Some(handler.inner());
}
Box::new(handler)
});
page = "remote.html";