chore: compute controls as a single value per platform

This commit is contained in:
2026-11-03 13:38:13 +07:00
parent 2b1a91ce64
commit 978aecb651
+9 -7
View File
@@ -20,7 +20,7 @@ use gpui_native_theme::ActiveTheme as _;
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
use gpui::Decorations; use gpui::Decorations;
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
use gpui::rgba; use gpui::{SharedString, px, rgba};
/// macOS traffic-lights zone: the pad a leading titlebar strip reserves. /// macOS traffic-lights zone: the pad a leading titlebar strip reserves.
pub const TRAFFIC_LIGHT_PAD: f32 = 78.0; pub const TRAFFIC_LIGHT_PAD: f32 = 78.0;
@@ -52,13 +52,13 @@ impl RenderOnce for WindowControls {
let id = self.id.clone(); let id = self.id.clone();
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
{ let controls = {
let _ = (id, window, cx); let _ = (id, window, cx);
div() div()
} };
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
{ let controls = {
let controls = window.window_controls(); let controls = window.window_controls();
div() div()
.flex_none() .flex_none()
@@ -97,10 +97,10 @@ impl RenderOnce for WindowControls {
true, true,
true, true,
)) ))
} };
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
{ let controls = {
let _ = id; let _ = id;
let controls = window.window_controls(); let controls = window.window_controls();
let client_decorated = let client_decorated =
@@ -143,7 +143,9 @@ impl RenderOnce for WindowControls {
|window, _cx| window.remove_window(), |window, _cx| window.remove_window(),
)) ))
}) })
} };
controls
} }
} }