From 98e5c9efb563602003ee8aa0655746c1aaf661e3 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Tue, 30 Nov 2021 00:09:17 +0100 Subject: [PATCH] Remove WINIT_LINK_COLORSYNC (no longer needed) Since https://github.com/rust-windowing/winit/pull/2078 we link to `ApplicationServices`, which contains the `CGDisplayCreateUUIDFromDisplayID` symbol in all versions. --- CHANGELOG.md | 1 + README.md | 10 ---------- build.rs | 10 ---------- src/platform_impl/macos/ffi.rs | 11 +---------- 4 files changed, 2 insertions(+), 30 deletions(-) delete mode 100644 build.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index bd827a94b3..e904b4350e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Unreleased +- Remove no longer needed `WINIT_LINK_COLORSYNC` environment variable. - Fix linking to the `ColorSync` framework on macOS 10.7, and in newer Rust versions. - On Web, implement cursor grabbing through the pointer lock API. - On X11, add mappings for numpad comma, numpad enter, numlock and pause. diff --git a/README.md b/README.md index 094ba5da4e..dc1f6974cb 100644 --- a/README.md +++ b/README.md @@ -118,13 +118,3 @@ fn main() { ``` And run the application with `cargo apk run --example request_redraw_threaded` - -#### MacOS - -To ensure compatibility with older MacOS systems, winit links to -CGDisplayCreateUUIDFromDisplayID through the CoreGraphics framework. -However, under certain setups this function is only available to be linked -through the newer ColorSync framework. So, winit provides the -`WINIT_LINK_COLORSYNC` environment variable which can be set to `1` or `true` -while compiling to enable linking via ColorSync. - diff --git a/build.rs b/build.rs deleted file mode 100644 index a092e63631..0000000000 --- a/build.rs +++ /dev/null @@ -1,10 +0,0 @@ -fn main() { - // If building for macos and WINIT_LINK_COLORSYNC is set to true - // use CGDisplayCreateUUIDFromDisplayID from ColorSync instead of CoreGraphics - if std::env::var("CARGO_CFG_TARGET_OS").map_or(false, |os| os == "macos") - && std::env::var("WINIT_LINK_COLORSYNC") - .map_or(false, |v| v == "1" || v.eq_ignore_ascii_case("true")) - { - println!("cargo:rustc-cfg=use_colorsync_cgdisplaycreateuuidfromdisplayid"); - } -} diff --git a/src/platform_impl/macos/ffi.rs b/src/platform_impl/macos/ffi.rs index 1767c7eaf9..6f44848621 100644 --- a/src/platform_impl/macos/ffi.rs +++ b/src/platform_impl/macos/ffi.rs @@ -170,16 +170,7 @@ pub type CGDisplayModeRef = *mut c_void; // directly. Fortunately, it has always been available as a subframework of // `ApplicationServices`, see: // https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/OSX_Technology_Overview/SystemFrameworks/SystemFrameworks.html#//apple_ref/doc/uid/TP40001067-CH210-BBCFFIEG -// -// TODO: Remove the WINIT_LINK_COLORSYNC hack, it is probably not needed. -#[cfg_attr( - not(use_colorsync_cgdisplaycreateuuidfromdisplayid), - link(name = "ApplicationServices", kind = "framework") -)] -#[cfg_attr( - use_colorsync_cgdisplaycreateuuidfromdisplayid, - link(name = "ColorSync", kind = "framework") -)] +#[link(name = "ApplicationServices", kind = "framework")] extern "C" { pub fn CGDisplayCreateUUIDFromDisplayID(display: CGDirectDisplayID) -> CFUUIDRef; }