mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-03-30 16:41:00 +03:00
try to fix issue #3261 with new api, but not sure if it works
This commit is contained in:
@@ -34,6 +34,8 @@ extern "C" {
|
||||
static kAXTrustedCheckOptionPrompt: CFStringRef;
|
||||
fn AXIsProcessTrustedWithOptions(options: CFDictionaryRef) -> BOOL;
|
||||
fn InputMonitoringAuthStatus(_: BOOL) -> BOOL;
|
||||
fn IsCanScreenRecording(_: BOOL) -> BOOL;
|
||||
fn CanUseNewApiForScreenCaptureCheck() -> BOOL;
|
||||
fn MacCheckAdminAuthorization() -> BOOL;
|
||||
fn MacGetModeNum(display: u32, numModes: *mut u32) -> BOOL;
|
||||
fn MacGetModes(
|
||||
@@ -71,6 +73,14 @@ pub fn is_can_input_monitoring(prompt: bool) -> bool {
|
||||
// https://stackoverflow.com/questions/56597221/detecting-screen-recording-settings-on-macos-catalina/
|
||||
// remove just one app from all the permissions: tccutil reset All com.carriez.rustdesk
|
||||
pub fn is_can_screen_recording(prompt: bool) -> bool {
|
||||
// we got some report that we show no permission even after set it, so we try to use new api for screen recording check
|
||||
// the new api is only available on macOS >= 10.15, but on stackoverflow, some people said it works on >= 10.16 (crash on 10.15),
|
||||
// but also some said it has bug on 10.16, so we just use it on 11.0.
|
||||
unsafe {
|
||||
if CanUseNewApiForScreenCaptureCheck() == YES {
|
||||
return IsCanScreenRecording(if prompt { YES } else { NO }) == YES;
|
||||
}
|
||||
}
|
||||
let mut can_record_screen: bool = false;
|
||||
unsafe {
|
||||
let our_pid: i32 = std::process::id() as _;
|
||||
|
||||
Reference in New Issue
Block a user