xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.49k stars 515 forks source link

[feature request] CoreGraphics: implement CGDisplayMode / CGDisplayModeGetRefreshRate #9958

Open janusw opened 4 years ago

janusw commented 4 years ago

It seems that CoreGraphics support is incomplete in Xamarin.Mac. Searching for CGDisplayModeGetRefreshRate in the github repo only gives me one hit:

https://github.com/xamarin/xamarin-macios/blob/main/tests/xtro-sharpie/macOS-CoreGraphics.ignore: !missing-pinvoke! CGDisplayModeGetRefreshRate is not bound

Background: I want to determine the screen refresh rate on MacOS via the Xamarin APIs. CoreGraphics has a function to accomplish that: CGDisplayModeGetRefreshRate. In Swift this is part of the class CGDisplayMode.

chamons commented 4 years ago

I looked at implementing this, but as Xamarin.Mac is currently disabled in Main until Xcode 12.2 land (due to last minute removal of bound APIs by Apple) it isn't a good time to land it.

Here my untested diff:

https://git.io/JT6EB