From 584295f3fadcb065ab9e63bb11f6ddfade99bdc5 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Fri, 6 Jan 2023 13:19:08 +0800 Subject: [PATCH] config_input not well tested yet --- flutter/lib/desktop/pages/desktop_home_page.dart | 13 +++++++++++++ src/platform/macos.mm | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/flutter/lib/desktop/pages/desktop_home_page.dart b/flutter/lib/desktop/pages/desktop_home_page.dart index 1e8512b2e..43ffbd1e3 100644 --- a/flutter/lib/desktop/pages/desktop_home_page.dart +++ b/flutter/lib/desktop/pages/desktop_home_page.dart @@ -42,6 +42,7 @@ class _DesktopHomePageState extends State var svcStopped = false.obs; var watchIsCanScreenRecording = false; var watchIsProcessTrust = false; + var watchIsInputMonitoring = false; Timer? _updateTimer; @override @@ -334,6 +335,12 @@ class _DesktopHomePageState extends State bind.mainIsProcessTrusted(prompt: true); watchIsProcessTrust = true; }, help: 'Help', link: translate("doc_mac_permission")); + } else if (!bind.mainIsCanInputMonitoring(prompt: false)) { + return buildInstallCard("Permissions", "config_input", "Configure", + () async { + bind.mainIsCanInputMonitoring(prompt: true); + watchIsInputMonitoring = true; + }, help: 'Help', link: translate("doc_mac_permission")); } else if (!svcStopped.value && bind.mainIsInstalled() && !bind.mainIsInstalledDaemon(prompt: false)) { @@ -467,6 +474,12 @@ class _DesktopHomePageState extends State setState(() {}); } } + if (watchIsInputMonitoring) { + if (bind.mainIsCanInputMonitoring(prompt: false)) { + watchIsInputMonitoring = false; + setState(() {}); + } + } }); Get.put(svcStopped, tag: 'stop-service'); rustDeskWinManager.registerActiveWindowListener(onActiveWindowChanged); diff --git a/src/platform/macos.mm b/src/platform/macos.mm index e6e1723a7..05653ec33 100644 --- a/src/platform/macos.mm +++ b/src/platform/macos.mm @@ -7,7 +7,7 @@ extern "C" bool InputMonitoringAuthStatus(bool prompt) { if (@available(macos 10.15, *)) { IOHIDAccessType theType = IOHIDCheckAccess(kIOHIDRequestTypeListenEvent); - NSLog(@"IOHIDCheckAccess = %d", theType); + NSLog(@"IOHIDCheckAccess = %d, kIOHIDAccessTypeGranted = %d", theType, kIOHIDAccessTypeGranted); switch (theType) { case kIOHIDAccessTypeGranted: return true;