tmp commit
Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
parent
fd12f69afa
commit
01ab0cf196
@ -326,9 +326,9 @@ class _GeneralState extends State<_General> {
|
|||||||
update: () {
|
update: () {
|
||||||
final useSeparateWindow =
|
final useSeparateWindow =
|
||||||
mainGetLocalBoolOptionSync(kOptionSeparateRemoteWindow);
|
mainGetLocalBoolOptionSync(kOptionSeparateRemoteWindow);
|
||||||
// if (useSeparateWindow) {
|
if (useSeparateWindow) {
|
||||||
rustDeskWinManager.separateWindows();
|
rustDeskWinManager.separateWindows();
|
||||||
// }
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
@ -1656,13 +1656,13 @@ class FFI {
|
|||||||
final cb = ffiModel.startEventListener(sessionId, id);
|
final cb = ffiModel.startEventListener(sessionId, id);
|
||||||
final useTextureRender = bind.mainUseTextureRender();
|
final useTextureRender = bind.mainUseTextureRender();
|
||||||
|
|
||||||
final SimpleWrapper<bool> isPeerInfoSent = SimpleWrapper(false);
|
final SimpleWrapper<bool> isCacheRestored = SimpleWrapper(false);
|
||||||
// Preserved for the rgba data.
|
// Preserved for the rgba data.
|
||||||
stream.listen((message) {
|
stream.listen((message) {
|
||||||
if (closed) return;
|
if (closed) return;
|
||||||
if (isSessionAdded && !isPeerInfoSent.value) {
|
if (isSessionAdded && !isCacheRestored.value) {
|
||||||
bind.sessionHandlePeerInfo(sessionId: sessionId);
|
bind.sessionRestoreCache(sessionId: sessionId);
|
||||||
isPeerInfoSent.value = true;
|
isCacheRestored.value = true;
|
||||||
}
|
}
|
||||||
() async {
|
() async {
|
||||||
if (message is EventToUI_Event) {
|
if (message is EventToUI_Event) {
|
||||||
|
@ -49,10 +49,10 @@ class RustDeskMultiWindowManager {
|
|||||||
final String sessionIdList = await DesktopMultiWindow.invokeMethod(
|
final String sessionIdList = await DesktopMultiWindow.invokeMethod(
|
||||||
windowId, kWindowEventGetSessionIdList, null);
|
windowId, kWindowEventGetSessionIdList, null);
|
||||||
final idList = sessionIdList.split(';');
|
final idList = sessionIdList.split(';');
|
||||||
// if (idList.length <= 1) {
|
if (idList.length <= 1) {
|
||||||
// continue;
|
continue;
|
||||||
// }
|
}
|
||||||
for (final idPair in idList) {
|
for (final idPair in idList.sublist(1)) {
|
||||||
final peerSession = idPair.split(',');
|
final peerSession = idPair.split(',');
|
||||||
var params = {
|
var params = {
|
||||||
'type': WindowType.RemoteDesktop.index,
|
'type': WindowType.RemoteDesktop.index,
|
||||||
|
@ -1010,7 +1010,7 @@ impl<T: InvokeUiSession> Remote<T> {
|
|||||||
Some(login_response::Union::PeerInfo(pi)) => {
|
Some(login_response::Union::PeerInfo(pi)) => {
|
||||||
#[cfg(feature = "flutter")]
|
#[cfg(feature = "flutter")]
|
||||||
{
|
{
|
||||||
*self.handler.pi.write().unwrap() = pi.clone();
|
self.handler.cache_flutter.write().unwrap().pi = pi.clone();
|
||||||
}
|
}
|
||||||
self.handler.handle_peer_info(pi);
|
self.handler.handle_peer_info(pi);
|
||||||
#[cfg(not(feature = "flutter"))]
|
#[cfg(not(feature = "flutter"))]
|
||||||
@ -1059,9 +1059,20 @@ impl<T: InvokeUiSession> Remote<T> {
|
|||||||
_ => {}
|
_ => {}
|
||||||
},
|
},
|
||||||
Some(message::Union::CursorData(cd)) => {
|
Some(message::Union::CursorData(cd)) => {
|
||||||
|
#[cfg(feature = "flutter")]
|
||||||
|
{
|
||||||
|
let mut lock = self.handler.cache_flutter.write().unwrap();
|
||||||
|
if !lock.cursor_data.contains_key(&cd.id) {
|
||||||
|
lock.cursor_data.insert(cd.id, cd.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
self.handler.set_cursor_data(cd);
|
self.handler.set_cursor_data(cd);
|
||||||
}
|
}
|
||||||
Some(message::Union::CursorId(id)) => {
|
Some(message::Union::CursorId(id)) => {
|
||||||
|
#[cfg(feature = "flutter")]
|
||||||
|
{
|
||||||
|
self.handler.cache_flutter.write().unwrap().cursor_id = id;
|
||||||
|
}
|
||||||
self.handler.set_cursor_id(id.to_string());
|
self.handler.set_cursor_id(id.to_string());
|
||||||
}
|
}
|
||||||
Some(message::Union::CursorPosition(cp)) => {
|
Some(message::Union::CursorPosition(cp)) => {
|
||||||
@ -1280,7 +1291,7 @@ impl<T: InvokeUiSession> Remote<T> {
|
|||||||
Some(misc::Union::SwitchDisplay(s)) => {
|
Some(misc::Union::SwitchDisplay(s)) => {
|
||||||
#[cfg(feature = "flutter")]
|
#[cfg(feature = "flutter")]
|
||||||
{
|
{
|
||||||
*self.handler.switch_display.write().unwrap() = s.clone();
|
self.handler.cache_flutter.write().unwrap().sp = s.clone();
|
||||||
}
|
}
|
||||||
self.handler.handle_peer_switch_display(&s);
|
self.handler.handle_peer_switch_display(&s);
|
||||||
self.video_sender.send(MediaData::Reset).ok();
|
self.video_sender.send(MediaData::Reset).ok();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||||
use crate::common::get_default_sound_input;
|
use crate::common::get_default_sound_input;
|
||||||
use crate::{
|
use crate::{
|
||||||
client::{file_trait::FileManager, Interface},
|
client::file_trait::FileManager,
|
||||||
common::is_keyboard_mode_supported,
|
common::is_keyboard_mode_supported,
|
||||||
common::make_fd_to_json,
|
common::make_fd_to_json,
|
||||||
flutter::{self, SESSIONS},
|
flutter::{self, SESSIONS},
|
||||||
@ -601,11 +601,9 @@ pub fn session_change_resolution(session_id: SessionID, display: i32, width: i32
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn session_handle_peer_info(session_id: SessionID) {
|
pub fn session_restore_cache(session_id: SessionID) {
|
||||||
if let Some(session) = SESSIONS.write().unwrap().get_mut(&session_id) {
|
if let Some(session) = SESSIONS.write().unwrap().get_mut(&session_id) {
|
||||||
let pi = session.pi.read().unwrap().clone();
|
session.restore_flutter_cache();
|
||||||
session.handle_peer_info(pi);
|
|
||||||
session.handle_peer_switch_display(&session.switch_display.read().unwrap());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +48,15 @@ pub static IS_IN: AtomicBool = AtomicBool::new(false);
|
|||||||
|
|
||||||
const CHANGE_RESOLUTION_VALID_TIMEOUT_SECS: u64 = 15;
|
const CHANGE_RESOLUTION_VALID_TIMEOUT_SECS: u64 = 15;
|
||||||
|
|
||||||
|
#[cfg(feature = "flutter")]
|
||||||
|
#[derive(Default)]
|
||||||
|
pub struct CacheFlutter {
|
||||||
|
pub pi: PeerInfo,
|
||||||
|
pub sp: SwitchDisplay,
|
||||||
|
pub cursor_data: HashMap<u64, CursorData>,
|
||||||
|
pub cursor_id: u64,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
pub struct Session<T: InvokeUiSession> {
|
pub struct Session<T: InvokeUiSession> {
|
||||||
pub session_id: SessionID, // different from the one in LoginConfigHandler, used for flutter UI message pass
|
pub session_id: SessionID, // different from the one in LoginConfigHandler, used for flutter UI message pass
|
||||||
@ -63,9 +72,7 @@ pub struct Session<T: InvokeUiSession> {
|
|||||||
pub server_clipboard_enabled: Arc<RwLock<bool>>,
|
pub server_clipboard_enabled: Arc<RwLock<bool>>,
|
||||||
pub last_change_display: Arc<Mutex<ChangeDisplayRecord>>,
|
pub last_change_display: Arc<Mutex<ChangeDisplayRecord>>,
|
||||||
#[cfg(feature = "flutter")]
|
#[cfg(feature = "flutter")]
|
||||||
pub pi: Arc<RwLock<PeerInfo>>,
|
pub cache_flutter: Arc<RwLock<CacheFlutter>>,
|
||||||
#[cfg(feature = "flutter")]
|
|
||||||
pub switch_display: Arc<RwLock<SwitchDisplay>>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
@ -1185,6 +1192,17 @@ impl<T: InvokeUiSession> Session<T> {
|
|||||||
pub fn ctrl_alt_del(&self) {
|
pub fn ctrl_alt_del(&self) {
|
||||||
self.send_key_event(&crate::keyboard::client::event_ctrl_alt_del());
|
self.send_key_event(&crate::keyboard::client::event_ctrl_alt_del());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "flutter")]
|
||||||
|
pub fn restore_flutter_cache(&mut self) {
|
||||||
|
let pi = self.cache_flutter.read().unwrap().pi.clone();
|
||||||
|
self.handle_peer_info(pi);
|
||||||
|
self.handle_peer_switch_display(&self.cache_flutter.read().unwrap().sp);
|
||||||
|
for (_, cd) in self.cache_flutter.read().unwrap().cursor_data.iter() {
|
||||||
|
self.set_cursor_data(cd.clone());
|
||||||
|
}
|
||||||
|
self.set_cursor_id(self.cache_flutter.read().unwrap().cursor_id.to_string());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::main(flavor = "current_thread")]
|
#[tokio::main(flavor = "current_thread")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user