mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-08 23:03:42 -05:00
Fix macOS Tahoe stoplight positioning and build on macOS 26
On macOS Tahoe (26+), the default title bar is 32px with 14px buttons, so the old formula (button_height + PAD_Y = 14 + 18 = 32) produced no change. Add TITLEBAR_EXTRA_HEIGHT to push the title bar taller than the Tahoe default. Use OnceLock to capture the original default height so repeated calls don't accumulate extra pixels. Also update CI runners to macos-26 for Tahoe SDK builds and adjust frontend padding for larger stoplights. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
4
.github/workflows/release-app.yml
vendored
4
.github/workflows/release-app.yml
vendored
@@ -13,12 +13,12 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- platform: "macos-latest" # for Arm-based Macs (M1 and above).
|
||||
- platform: "macos-26" # for Arm-based Macs (M1 and above).
|
||||
args: "--target aarch64-apple-darwin"
|
||||
yaak_arch: "arm64"
|
||||
os: "macos"
|
||||
targets: "aarch64-apple-darwin"
|
||||
- platform: "macos-latest" # for Intel-based Macs.
|
||||
- platform: "macos-26-intel" # for Intel-based Macs.
|
||||
args: "--target x86_64-apple-darwin"
|
||||
yaak_arch: "x64"
|
||||
os: "macos"
|
||||
|
||||
@@ -12,6 +12,11 @@ unsafe impl Sync for UnsafeWindowHandle {}
|
||||
|
||||
const WINDOW_CONTROL_PAD_X: f64 = 13.0;
|
||||
const WINDOW_CONTROL_PAD_Y: f64 = 18.0;
|
||||
/// Extra pixels to add to the title bar height when the default title bar is
|
||||
/// already as tall as button_height + PAD_Y (i.e. macOS Tahoe 26+, where the
|
||||
/// default is 32px and 14 + 18 = 32). On pre-Tahoe this is unused because the
|
||||
/// default title bar is shorter than button_height + PAD_Y.
|
||||
const TITLEBAR_EXTRA_HEIGHT: f64 = 4.0;
|
||||
const MAIN_WINDOW_PREFIX: &str = "main_";
|
||||
|
||||
pub(crate) fn update_window_title<R: Runtime>(window: Window<R>, title: String) {
|
||||
@@ -95,12 +100,29 @@ fn position_traffic_lights(ns_window_handle: UnsafeWindowHandle, x: f64, y: f64,
|
||||
ns_window.standardWindowButton_(NSWindowButton::NSWindowMiniaturizeButton);
|
||||
let zoom = ns_window.standardWindowButton_(NSWindowButton::NSWindowZoomButton);
|
||||
|
||||
let title_bar_container_view = close.superview().superview();
|
||||
|
||||
let close_rect: NSRect = msg_send![close, frame];
|
||||
let button_height = close_rect.size.height;
|
||||
|
||||
let title_bar_frame_height = button_height + y;
|
||||
let title_bar_container_view = close.superview().superview();
|
||||
|
||||
// Capture the OS default title bar height on the first call, before
|
||||
// we've modified it. This avoids the height growing on repeated calls.
|
||||
use std::sync::OnceLock;
|
||||
static DEFAULT_TITLEBAR_HEIGHT: OnceLock<f64> = OnceLock::new();
|
||||
let default_height =
|
||||
*DEFAULT_TITLEBAR_HEIGHT.get_or_init(|| NSView::frame(title_bar_container_view).size.height);
|
||||
|
||||
// On pre-Tahoe, button_height + y is larger than the default title bar
|
||||
// height, so the resize works as before. On Tahoe (26+), the default is
|
||||
// already 32px and button_height + y = 32, so nothing changes. In that
|
||||
// case, add TITLEBAR_EXTRA_HEIGHT extra pixels to push the buttons down.
|
||||
let desired = button_height + y;
|
||||
let title_bar_frame_height = if desired > default_height {
|
||||
desired
|
||||
} else {
|
||||
default_height + TITLEBAR_EXTRA_HEIGHT
|
||||
};
|
||||
|
||||
let mut title_bar_rect = NSView::frame(title_bar_container_view);
|
||||
title_bar_rect.size.height = title_bar_frame_height;
|
||||
title_bar_rect.origin.y = NSView::frame(ns_window).size.height - title_bar_frame_height;
|
||||
|
||||
@@ -40,7 +40,7 @@ export function HeaderSize({
|
||||
} else if (type() === 'macos') {
|
||||
if (!isFullscreen) {
|
||||
// Add large padding for window controls
|
||||
s.paddingLeft = 72 / settings.interfaceScale;
|
||||
s.paddingLeft = 76 / settings.interfaceScale;
|
||||
}
|
||||
} else if (!ignoreControlsSpacing && !settings.hideWindowControls) {
|
||||
s.paddingRight = WINDOW_CONTROLS_WIDTH;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export const HEADER_SIZE_MD = '27px';
|
||||
export const HEADER_SIZE_MD = '30px';
|
||||
export const HEADER_SIZE_LG = '40px';
|
||||
|
||||
export const WINDOW_CONTROLS_WIDTH = '10.5rem';
|
||||
|
||||
Reference in New Issue
Block a user