Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: return preflightscreencapture as true for all non zero values #678

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Pranav2612000
Copy link

Fixes #677

@Pranav2612000
Copy link
Author

@jrmuizel Can you please take a look?

@@ -14,7 +14,7 @@ impl ScreenCaptureAccess {
/// Return `true` if has access
#[inline]
pub fn preflight(&self) -> bool {
unsafe { CGPreflightScreenCaptureAccess() == 1 }
unsafe { (CGPreflightScreenCaptureAccess() & 1) == 1 }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this return false if CGPreflightScreenCaptureAccess() returns 2?
Should request() also be changed.

Can you also add some more documentation about what semantics you expect CGPreflightScreenCaptureAccess() to have. i.e. what are the non 1 values you see it returning.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i.e. what are the non 1 values you see it returning.

I don't remember the exact value, but it was a 16bit number where the last 8 bits were 00000001

Won't this return false if CGPreflightScreenCaptureAccess() returns 2?

Yes. It would. But I think 2 won't be returned.

Should request() also be changed.

Yup. I'll do the change if this change looks good. preflight was on a higher priority so I did this change first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ScreenCaptureAccess.preflight returns incorrect value for Intel based 64bit Mac
2 participants