Create new core:sys/darwin/CoreGraphics package
#6147
Merged
+115
−12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Apple's CoreGraphics framework provides an API for displays (laptop screens, external monitors, etc.) and the mouse cursor. It also provides many other things, but these two use cases are the motivation behind this PR.
My new
core:sys/darwin/CoreGraphicspackage is mostly straightforward;foreign importthe Core Graphics framework and translate the C types into Odin types.But there is one decision I made that is worth mentioning; I made
core:sys/darwin/Foundationimportcore:sys/darwin/CoreGraphics. This means thatCoreGraphicsis not allowed to importFoundation, which would be a problem ifCoreGraphicsused, for example,NSObject. I searched the C headers of Core Graphics and did not find any types prefixed withNS, so we are safe there, but there is a chance of running into cyclic imports when adding more bindings forCoreGraphicsin the future. If that happens, we can duplicate a couple type definitions or define a third package containing shared type definitions. Not the end of the world.Other than that, I added a couple bindings for Foundation. And all new bindings, including for Core Graphics, have been run on my machine to verify that they work.
This is my first time proposing a new Odin package. Is there anything I should do relating to package documentation?