From 4221a30e58ae34ae741967be5455d835e49e8ffd 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 72fd7d724c..6eda123815 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ And please only add new entries to the top of this list, right below the `# Unre # Unreleased +- Remove no longer needed `WINIT_LINK_COLORSYNC` environment variable. - **Breaking:** Rename the `Exit` variant of `ControlFlow` to `ExitWithCode`, which holds a value to control the exit code after running. Add an `Exit` constant which aliases to `ExitWithCode(0)` instead to avoid major breakage. This shouldn't affect most existing programs. # 0.26.1 (2022-01-05) diff --git a/README.md b/README.md index f4af31fccf..761d0b129c 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 8296bef20a..229bd6598d 100644 --- a/src/platform_impl/macos/ffi.rs +++ b/src/platform_impl/macos/ffi.rs @@ -171,16 +171,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; }