Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix traffic light padding on macOS SDK 26+ builds (#58245)
Albert Boguszeb03be7ae23c
diff --git a/crates/title_bar/src/title_bar.rs b/crates/title_bar/src/title_bar.rsindex 73c183289a2..965a6d4acd9 100644--- a/crates/title_bar/src/title_bar.rs+++ b/crates/title_bar/src/title_bar.rs@@ -659,7 +659,7 @@ impl TitleBar {})});- if cfg!(macos_sdk_26) {+ if ui::utils::MACOS_SDK_26_OR_LATER {// Make up for Tahoe's traffic light buttons having less spacing around themSome(div().child(button).ml_0p5().into_any_element())} else {diff --git a/crates/title_bar/build.rs b/crates/ui/build.rssimilarity index 83%rename from crates/title_bar/build.rsrename to crates/ui/build.rsindex ef70268ad31..aa890de9532 100644--- a/crates/title_bar/build.rs+++ b/crates/ui/build.rs@@ -1,7 +1,7 @@#![allow(clippy::disallowed_methods, reason = "build scripts are exempt")]fn main() {- println!("cargo::rustc-check-cfg=cfg(macos_sdk_26)");+ println!("cargo::rustc-check-cfg=cfg(macos_sdk_26_or_later)");#[cfg(target_os = "macos")]{@@ -22,7 +22,7 @@ fn main() {if let Some(major) = major_version&& major >= 26{- println!("cargo:rustc-cfg=macos_sdk_26");+ println!("cargo:rustc-cfg=macos_sdk_26_or_later");}}}diff --git a/crates/ui/src/utils/constants.rs b/crates/ui/src/utils/constants.rsindex 823155889f7..1ab565ba372 100644--- a/crates/ui/src/utils/constants.rs+++ b/crates/ui/src/utils/constants.rs@@ -1,15 +1,13 @@use gpui::{Pixels, Window, px};+pub const MACOS_SDK_26_OR_LATER: bool = cfg!(macos_sdk_26_or_later);+// Use pixels here instead of a rem-based size because the macOS traffic// lights are a static size, and don't scale with the rest of the UI.//// Magic number: There is one extra pixel of padding on the left side due to// the 1px border around the window on macOS apps.-#[cfg(macos_sdk_26)]-pub const TRAFFIC_LIGHT_PADDING: f32 = 78.;--#[cfg(not(macos_sdk_26))]-pub const TRAFFIC_LIGHT_PADDING: f32 = 71.;+pub const TRAFFIC_LIGHT_PADDING: f32 = if MACOS_SDK_26_OR_LATER { 78. } else { 71. };/// Returns the platform-appropriate title bar height.///