From 8dc4f408e2105fba3700670846df3a99f681a226 Mon Sep 17 00:00:00 2001 From: Pewnack <[email protected]> Date: Fri, 27 Mar 2026 07:23:45 +0100 Subject: [PATCH] Some CoreGraphics functions are only available on macOS --- src/native/apple/frameworks.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/native/apple/frameworks.rs b/src/native/apple/frameworks.rs index f9ab8fa4..d4a1c22c 100644 --- a/src/native/apple/frameworks.rs +++ b/src/native/apple/frameworks.rs @@ -188,8 +188,6 @@ extern "C" { window_id: u32, imageoptions: u32, ) -> ObjcId; - pub fn CGMainDisplayID() -> u32; - pub fn CGDisplayPixelsHigh(display: u32) -> u64; pub fn CGColorCreateGenericRGB(red: f64, green: f64, blue: f64, alpha: f64) -> ObjcId; pub fn CGAssociateMouseAndMouseCursorPosition(connected: bool); pub fn CGWarpMouseCursorPosition(newCursorPosition: NSPoint); @@ -221,6 +219,14 @@ extern "C" { pub fn CGColorSpaceRelease(space: *const ObjcId); } +// Some CoreGraphics functions are only available on macOS +#[cfg(target_os = "macos")] +#[link(name = "CoreGraphics", kind = "framework")] +extern "C" { + pub fn CGMainDisplayID() -> u32; + pub fn CGDisplayPixelsHigh(display: u32) -> u64; +} + pub const kCGBitmapByteOrderDefault: u32 = 0 << 12; pub const kCGImageAlphaLast: u32 = 3; pub const kCGRenderingIntentDefault: u32 = 0;