Correct screen capture access return values. (#698)

Both `CGRequestScreenCaptureAccess` and `CGPreflightScreenCaptureAccess`
return `bool`, not `boolean_t`.

Fixes #677.
Replaces #678.
This commit is contained in:
Bruce Mitchener
2024-08-12 08:27:32 +07:00
committed by GitHub
parent b10b72c0cc
commit e513e990dc
+4 -6
View File
@@ -1,5 +1,3 @@
pub use crate::base::boolean_t;
#[derive(Default)]
pub struct ScreenCaptureAccess;
@@ -8,19 +6,19 @@ impl ScreenCaptureAccess {
/// Return the same result as preflight.
#[inline]
pub fn request(&self) -> bool {
unsafe { CGRequestScreenCaptureAccess() == 1 }
unsafe { CGRequestScreenCaptureAccess() }
}
/// Return `true` if has access
#[inline]
pub fn preflight(&self) -> bool {
unsafe { CGPreflightScreenCaptureAccess() == 1 }
unsafe { CGPreflightScreenCaptureAccess() }
}
}
#[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))]
extern "C" {
// Screen Capture Access
fn CGRequestScreenCaptureAccess() -> boolean_t;
fn CGPreflightScreenCaptureAccess() -> boolean_t;
fn CGRequestScreenCaptureAccess() -> bool;
fn CGPreflightScreenCaptureAccess() -> bool;
}