servo / core-foundation-rs

Rust bindings to Core Foundation and other low level libraries on Mac OS X and iOS
Other
987 stars 216 forks source link

Adds FFI and wrapper for CGDisplayReconfigurationCallback related APIs #687

Closed xanathar closed 1 month ago

xanathar commented 2 months ago

This CR contains two main commits:

The first one adds unsafe bindings and type declarations for:

The second one adds a type called CGDisplayReconfigurationCallbackHandle that safely manages the reconfiguration callbacks for a generic boxed FnMut(CGDirectDisplayID, CGDisplayChangeSummaryFlags), taking care of marshalling the pointers around in the correct way... hopefully (one can never be sure).

The second commit, I guess, might be more controversial so let me know if unwanted and I will resend the PR with just the first part (and host the second in a different repo/crate).

wusyong commented 2 months ago

Yeah, I feel like the second commit probably doesn't fit this repo. It's up to users to define the callback wrapper.

xanathar commented 2 months ago

Updated to have only the first commit.