From 1074dd4d1d904e09b03600f5e7f9e1a6c080ef1a Mon Sep 17 00:00:00 2001 From: ShootingStarDragons Date: Sun, 3 Sep 2023 17:28:17 +0800 Subject: [PATCH] chore: adjust remote --- src/remotedesktop.rs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/remotedesktop.rs b/src/remotedesktop.rs index 90d6e51..a4e2ba3 100644 --- a/src/remotedesktop.rs +++ b/src/remotedesktop.rs @@ -164,18 +164,6 @@ impl RemoteDesktopBackend { _parent_window: String, _options: HashMap>, ) -> zbus::fdo::Result> { - let remote_sessions = REMOTE_SESSIONS.lock().await; - if let Some(session) = remote_sessions - .iter() - .find(|session| session.0 == session_handle.to_string()) - { - return Ok(PortalResponse::Success(RemoteStartReturnValue { - streams: vec![Stream(session.1.node_id(), StreamProperties::default())], - ..Default::default() - })); - } - drop(remote_sessions); - let locked_sessions = SESSIONS.lock().await; let Some(index) = locked_sessions .iter() @@ -192,6 +180,19 @@ impl RemoteDesktopBackend { let device_type = current_session.device_type; drop(locked_sessions); + let remote_sessions = REMOTE_SESSIONS.lock().await; + if let Some(session) = remote_sessions + .iter() + .find(|session| session.0 == session_handle.to_string()) + { + return Ok(PortalResponse::Success(RemoteStartReturnValue { + streams: vec![Stream(session.1.node_id(), StreamProperties::default())], + devices: device_type, + ..Default::default() + })); + } + drop(remote_sessions); + // TODO: use slurp now let show_cursor = current_session.cursor_mode.show_cursor(); let connection = libwayshot::WayshotConnection::new().unwrap();