Skip to content

Commit d8808ba

Browse files
wysuperflyCodex
andauthored
Allow macOS monitor switching in privacy mode (rustdesk#15004)
Co-authored-by: Codex <codex@openai.local>
1 parent 1978020 commit d8808ba

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

flutter/lib/common/widgets/toolbar.dart

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ import 'package:get/get.dart';
1616

1717
bool isEditOsPassword = false;
1818

19+
// macOS privacy mode blacks out all online displays, so switching the remote
20+
// display does not weaken the local privacy protection.
21+
bool allowDisplaySwitchInPrivacyMode(PeerInfo pi) {
22+
return pi.platform == kPeerPlatformMacOS;
23+
}
24+
1925
class TTextMenu {
2026
final Widget child;
2127
final VoidCallback? onPressed;
@@ -684,8 +690,9 @@ Future<List<TToggleMenu>> toolbarDisplayToggle(
684690
child: Text(translate('Lock after session end'))));
685691
}
686692

693+
final privacyModeState = PrivacyModeState.find(id);
687694
if (pi.isSupportMultiDisplay &&
688-
PrivacyModeState.find(id).isEmpty &&
695+
(privacyModeState.isEmpty || allowDisplaySwitchInPrivacyMode(pi)) &&
689696
pi.displaysCount.value > 1 &&
690697
bind.mainGetUserDefaultOption(key: kKeyShowMonitorsToolbar) == 'Y') {
691698
final value =
@@ -776,7 +783,8 @@ List<TToggleMenu> toolbarPrivacyMode(
776783
onChanged: enabled
777784
? (value) {
778785
if (value == null) return;
779-
if (ffiModel.pi.currentDisplay != 0 &&
786+
if (!allowDisplaySwitchInPrivacyMode(pi) &&
787+
ffiModel.pi.currentDisplay != 0 &&
780788
ffiModel.pi.currentDisplay != kAllDisplayValue) {
781789
msgBox(
782790
sessionId,

flutter/lib/desktop/widgets/remote_toolbar.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,8 @@ class _RemoteToolbarState extends State<RemoteToolbar> {
376376
}
377377

378378
toolbarItems.add(Obx(() {
379-
if (PrivacyModeState.find(widget.id).isEmpty &&
379+
if ((PrivacyModeState.find(widget.id).isEmpty ||
380+
allowDisplaySwitchInPrivacyMode(pi)) &&
380381
pi.displaysCount.value > 1) {
381382
return _MonitorMenu(
382383
id: widget.id,

0 commit comments

Comments
 (0)