From e513e990dc66acb28deadeeae39059b054eb20a2 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Mon, 12 Aug 2024 08:27:32 +0700 Subject: [PATCH] Correct screen capture access return values. (#698) Both `CGRequestScreenCaptureAccess` and `CGPreflightScreenCaptureAccess` return `bool`, not `boolean_t`. Fixes #677. Replaces #678. --- core-graphics/src/access.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/core-graphics/src/access.rs b/core-graphics/src/access.rs index cd51acb0..014ff31a 100644 --- a/core-graphics/src/access.rs +++ b/core-graphics/src/access.rs @@ -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; }