From d4ded3ce2520a3d4369a2de51b8bc3de220b458e Mon Sep 17 00:00:00 2001 From: Albert Bogusz Date: Mon, 1 Jun 2026 17:35:05 +0100 Subject: [PATCH 1/2] Fix traffic light clearance on macOS SDK 26+ builds --- crates/title_bar/src/title_bar.rs | 2 +- crates/{title_bar => ui}/build.rs | 4 ++-- crates/ui/src/utils/constants.rs | 12 +++++++----- 3 files changed, 10 insertions(+), 8 deletions(-) rename crates/{title_bar => ui}/build.rs (83%) diff --git a/crates/title_bar/src/title_bar.rs b/crates/title_bar/src/title_bar.rs index 73c183289a2907..965a6d4acd9db0 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 them Some(div().child(button).ml_0p5().into_any_element()) } else { diff --git a/crates/title_bar/build.rs b/crates/ui/build.rs similarity index 83% rename from crates/title_bar/build.rs rename to crates/ui/build.rs index ef70268ad3127b..aa890de9532496 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.rs index 823155889f7b4c..be9cf23c4ec2be 100644 --- a/crates/ui/src/utils/constants.rs +++ b/crates/ui/src/utils/constants.rs @@ -1,15 +1,17 @@ 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. /// From bd41361b8a836aa4bde90ff46f8c19b6faebce5c Mon Sep 17 00:00:00 2001 From: Albert Bogusz Date: Mon, 1 Jun 2026 17:55:28 +0100 Subject: [PATCH 2/2] Make cargo fmt happy --- crates/ui/src/utils/constants.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/crates/ui/src/utils/constants.rs b/crates/ui/src/utils/constants.rs index be9cf23c4ec2be..1ab565ba372ced 100644 --- a/crates/ui/src/utils/constants.rs +++ b/crates/ui/src/utils/constants.rs @@ -7,11 +7,7 @@ pub const MACOS_SDK_26_OR_LATER: bool = cfg!(macos_sdk_26_or_later); // // Magic number: There is one extra pixel of padding on the left side due to // the 1px border around the window on macOS apps. -pub const TRAFFIC_LIGHT_PADDING: f32 = if MACOS_SDK_26_OR_LATER { - 78. -} else { - 71. -}; +pub const TRAFFIC_LIGHT_PADDING: f32 = if MACOS_SDK_26_OR_LATER { 78. } else { 71. }; /// Returns the platform-appropriate title bar height. ///