Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/macos/impl_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ use objc2_core_foundation::{
CFBoolean, CFDictionary, CFNumber, CFNumberType, CFRetained, CFString, CGPoint, CGRect,
};
use objc2_core_graphics::{
CGDisplayBounds, CGMainDisplayID, CGRectContainsPoint, CGRectIntersectsRect,
CGRectMakeWithDictionaryRepresentation, CGWindowListCopyWindowInfo, CGWindowListOption,
CGDisplayBounds, CGMainDisplayID, CGPreflightScreenCaptureAccess, CGRectContainsPoint,
CGRectIntersectsRect, CGRectMakeWithDictionaryRepresentation, CGWindowListCopyWindowInfo,
CGWindowListOption,
};
use objc2_foundation::{NSNumber, NSString};

Expand Down Expand Up @@ -159,6 +160,13 @@ impl ImplWindow {

pub fn all() -> XCapResult<Vec<ImplWindow>> {
unsafe {
if !CGPreflightScreenCaptureAccess() {
log::warn!(
"Screen Recording permission not granted. \
Grant access in System Settings > Privacy & Security > Screen Recording"
);
}

let mut impl_window = Vec::new();

// CGWindowListCopyWindowInfo 返回窗口顺序为从顶层到最底层
Expand Down