1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//! Screen Recording (TCC) authorization probe via ScreenCaptureKit.
//!
//! `SCShareableContent.getShareableContentWithCompletionHandler:` is
//! the only macOS API that reports Screen Recording authorization
//! truthfully. Every CoreGraphics alternative gives a false positive
//! when the grant is missing — verified on macOS 15 against a real
//! `tccutil reset ScreenCapture com.jondkinney.vernier`:
//!
//! - `CGPreflightScreenCaptureAccess` returns `true`.
//! - `CGWindowListCreateImage` / `CGDisplayCreateImageForRect`
//! return a non-null *degraded* image (the desktop wallpaper plus
//! the caller's own windows) instead of failing.
//!
//! ScreenCaptureKit instead invokes its completion handler with a nil
//! `SCShareableContent` and a non-nil `NSError` when the process is
//! not authorized — an unambiguous signal. The first unauthorized
//! call also makes macOS surface the Screen Recording prompt.
//!
//! The API is asynchronous: the completion handler runs on a private
//! queue. [`probe_screen_recording`] therefore returns a
//! `Receiver<bool>` the caller drains without blocking.
use ;
use RcBlock;
use NSError;
use SCShareableContent;
/// Start an asynchronous Screen Recording authorization probe.
///
/// Returns immediately. The `Receiver` yields exactly one `bool`:
/// `true` if this process is authorized to capture the screen,
/// `false` otherwise.
pub