Skip to content

Commit e513e99

Browse files
Correct screen capture access return values. (#698)
Both `CGRequestScreenCaptureAccess` and `CGPreflightScreenCaptureAccess` return `bool`, not `boolean_t`. Fixes #677. Replaces #678.
1 parent b10b72c commit e513e99

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

core-graphics/src/access.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
pub use crate::base::boolean_t;
2-
31
#[derive(Default)]
42
pub struct ScreenCaptureAccess;
53

@@ -8,19 +6,19 @@ impl ScreenCaptureAccess {
86
/// Return the same result as preflight.
97
#[inline]
108
pub fn request(&self) -> bool {
11-
unsafe { CGRequestScreenCaptureAccess() == 1 }
9+
unsafe { CGRequestScreenCaptureAccess() }
1210
}
1311

1412
/// Return `true` if has access
1513
#[inline]
1614
pub fn preflight(&self) -> bool {
17-
unsafe { CGPreflightScreenCaptureAccess() == 1 }
15+
unsafe { CGPreflightScreenCaptureAccess() }
1816
}
1917
}
2018

2119
#[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))]
2220
extern "C" {
2321
// Screen Capture Access
24-
fn CGRequestScreenCaptureAccess() -> boolean_t;
25-
fn CGPreflightScreenCaptureAccess() -> boolean_t;
22+
fn CGRequestScreenCaptureAccess() -> bool;
23+
fn CGPreflightScreenCaptureAccess() -> bool;
2624
}

0 commit comments

Comments
 (0)