Debian Codegraph @

third_party/rust/core-graphics/src/access.rs

raw
1 pub use base::boolean_t;
2
3 #[derive(Default)]
4 pub struct ScreenCaptureAccess;
5
6 impl ScreenCaptureAccess {
7 /// If current app not in list, will open window.
8 /// Return the same result as preflight.
9 #[inline]
10 pub fn request(&self) -> bool {
11 unsafe { CGRequestScreenCaptureAccess() == 1 }
12 }
13
14 /// Return true if has access
15 #[inline]
16 pub fn preflight(&self) -> bool {
17 unsafe { CGPreflightScreenCaptureAccess() == 1 }
18 }
19 }
20
21 #[link(name = "CoreGraphics", kind = "framework")]
22 extern "C" {
23 // Screen Capture Access
24 fn CGRequestScreenCaptureAccess() -> boolean_t;
25 fn CGPreflightScreenCaptureAccess() -> boolean_t;
26 }