Open ghostwriternr opened 4 years ago
Quick note: I have little to no experience with C, much less Apple Dev tools. I have been using the neofetch script for years, which depends on this library, and has lately been showing incorrect resolutions due to Apple's latest changes. So rather than adding workarounds, I wanted to add support for this at the source, if possible.
Please do let me know if this could have been done in a better way, as well as major code improvements.
@jhford gentle nudge to review when you can : )
Bump.
Changes
Fetch max supported mode for each monitor
Newer versions of MacOS use a scaling factor (like 2x, which is the default for newer MacBooks), leading to the default mode being half the native resolution of the display. In such cases, it would be desirable to fetch the maximum resolution supported by the display (native resolution).
Add a getMax option to fetch this information.
Avoid de-reference in _compareCFDisplayModes
Currently, the
_compareCFDisplayModes
method usesCGDisplayModeRef*
as the first and second parameters, in alignment with theCFComparatorFunction
type alias declaration expecting anUnsafeRawPointer
. ButCGDisplayModeRef
is already a pointer toCGDisplayMode
and doesn't need a reference again to work as a comparator. Doing so also introduces extra referencing and dereferencing that can be avoided.