constants.rs

 1use gpui::{Pixels, Window, px};
 2
 3// Use pixels here instead of a rem-based size because the macOS traffic
 4// lights are a static size, and don't scale with the rest of the UI.
 5//
 6// Magic number: There is one extra pixel of padding on the left side due to
 7// the 1px border around the window on macOS apps.
 8#[cfg(macos_sdk_26)]
 9pub const TRAFFIC_LIGHT_PADDING: f32 = 78.;
10
11#[cfg(not(macos_sdk_26))]
12pub const TRAFFIC_LIGHT_PADDING: f32 = 71.;
13
14/// Returns the platform-appropriate title bar height.
15///
16/// On Windows, this returns a fixed height of 32px.
17/// On other platforms, it scales with the window's rem size (1.75x) with a minimum of 34px.
18#[cfg(not(target_os = "windows"))]
19pub fn platform_title_bar_height(window: &Window) -> Pixels {
20    (1.75 * window.rem_size()).max(px(34.))
21}
22
23#[cfg(target_os = "windows")]
24pub fn platform_title_bar_height(_window: &Window) -> Pixels {
25    // todo(windows) instead of hard coded size report the actual size to the Windows platform API
26    px(32.)
27}