An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.
Rust androidanydeskdartflatpakflutterflutter-appsioslinuxmacosp2prdpremote-controlremote-desktoprustrust-langteamviewervncwaylandwindows
virtual_display_privacy_mode, switch privacy mode directly
fufesou1905a81f9af8
diff --git a/flutter/lib/desktop/widgets/remote_toolbar.dart b/flutter/lib/desktop/widgets/remote_toolbar.dartindex 55da0fd69..ed399651f 100644--- a/flutter/lib/desktop/widgets/remote_toolbar.dart+++ b/flutter/lib/desktop/widgets/remote_toolbar.dart@@ -1073,9 +1073,7 @@ class _DisplayMenuState extends State<_DisplayMenu> {menuChildren: privacyModeList.map((e) => Obx(() => CkbMenuButton(value: e.value,- onChanged: (privacyModeState.isEmpty || e.value)- ? e.onChanged- : null,+ onChanged: e.onChanged,child: e.child,ffi: ffi))).toList()),diff --git a/flutter/lib/mobile/widgets/dialog.dart b/flutter/lib/mobile/widgets/dialog.dartindex 649e6d226..6b480c46e 100644--- a/flutter/lib/mobile/widgets/dialog.dart+++ b/flutter/lib/mobile/widgets/dialog.dart@@ -277,9 +277,7 @@ void setPrivacyModeDialog(visualDensity: VisualDensity.compact,title: value.child,value: value.value,- onChanged: (privacyModeState.isEmpty || value.value)- ? value.onChanged- : null,+ onChanged: value.onChanged,)).toList()),);diff --git a/src/lang/cn.rs b/src/lang/cn.rsindex 9985051cb..a838701d5 100644--- a/src/lang/cn.rs+++ b/src/lang/cn.rs@@ -568,8 +568,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("True color (4:4:4)", "真彩模式(4:4:4)"),("Enable blocking user input", "允许阻止用户输入"),("id_input_tip", ""),- ("privacy_mode_impl_mag_tip", "旧的 Windows API"),- ("privacy_mode_impl_virtual_display_tip", "禁用物理显示器"),+ ("privacy_mode_impl_mag_tip", "模式 1 (不推荐)"),+ ("privacy_mode_impl_virtual_display_tip", "模式 2 (推荐)"),("Enter privacy mode", "进入隐私模式"),("Exit privacy mode", "退出隐私模式"),].iter().cloned().collect();diff --git a/src/lang/en.rs b/src/lang/en.rsindex 3d9012411..3afb27bc6 100644--- a/src/lang/en.rs+++ b/src/lang/en.rs@@ -203,7 +203,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =("elevated_switch_display_msg", "Switch to the primary display because multiple displays are not supported in elevated mode."),("selinux_tip", "SELinux is enabled on your device, which may prevent RustDesk from running properly as controlled side."),("id_input_tip", "You can input an ID, a direct IP, or a domain with a port (<domain>:<port>).\nIf you want to access a device on another server, please append the server address (<id>@<server_address>?key=<key_value>), for example,\[email protected]:21117?key=5Qbwsde3unUcJBtrx9ZkvUmwFNoExHzpryHuPUdqlWM=.\nIf you want to access a device on a public server, please input \"<id>@public\", the key is not needed for public server"),- ("privacy_mode_impl_mag_tip", "Old Windows magnifier API"),- ("privacy_mode_impl_virtual_display_tip", "Disable physical displays"),+ ("privacy_mode_impl_mag_tip", "Mode 1 (deprecated)"),+ ("privacy_mode_impl_virtual_display_tip", "Mode 2 (recommended)"),].iter().cloned().collect();}diff --git a/src/privacy_mode.rs b/src/privacy_mode.rsindex afa72f50c..99d16e996 100644--- a/src/privacy_mode.rs+++ b/src/privacy_mode.rs@@ -177,23 +177,36 @@ fn get_supported_impl(impl_key: &str) -> String {pub fn turn_on_privacy(impl_key: &str, conn_id: i32) -> Option<ResultType<bool>> {// Check if privacy mode is already on or occupied by another onelet mut privacy_mode_lock = PRIVACY_MODE.lock().unwrap();++ // Check or switch privacy mode implementation+ let impl_key = get_supported_impl(impl_key);+ let mut cur_impl_lock = CUR_PRIVACY_MODE_IMPL.lock().unwrap();+if let Some(privacy_mode) = privacy_mode_lock.as_ref() {let check_on_conn_id = privacy_mode.check_on_conn_id(conn_id);match check_on_conn_id.as_ref() {- Ok(true) | Err(_) => return Some(check_on_conn_id),+ Ok(true) => {+ if *cur_impl_lock == impl_key {+ return Some(Ok(true));+ } else {+ // Same peer, switch to new implementation.+ }+ }+ Err(_) => return Some(check_on_conn_id),_ => {}}}- // Check or switch privacy mode implementation- let impl_key = get_supported_impl(impl_key);- let mut cur_impl_lock = CUR_PRIVACY_MODE_IMPL.lock().unwrap();if *cur_impl_lock != impl_key {if let Some(creator) = PRIVACY_MODE_CREATOR.lock().unwrap().get(&(&impl_key as &str)){+ if let Some(privacy_mode) = privacy_mode_lock.as_mut() {+ privacy_mode.clear();+ }+*privacy_mode_lock = Some(creator());*cur_impl_lock = impl_key.to_owned();} else {