History

Fix delayed titlebar clicks on macOS 27 Beta (#59836)

## Summary macOS 27 Beta delays clicks in titlebar regions while AppKit determines whether a gesture should become a drag, single click, or double click. Zed's main workspace windows render a custom titlebar that already handles window movement via `Window::start_window_move`, so they do not need AppKit's native movable-titlebar behavior. This sets `is_movable` to `false` for the main `MultiWorkspace` windows and documents the `WindowOptions::is_movable` caveat for GPUI users with custom titlebars. ## Background The previous fix for this, #58947, used AppKit's private `_opaqueRectForWindowMoveWhenInTitlebar` SPI to mark GPUI's full-size content view as app-owned titlebar content. That fixed delayed titlebar clicks, but was later reverted in #59214 because it also affected windows that rely on AppKit's native titlebar dragging, like the settings window. This PR takes a narrower approach by only changing Zed's main custom-titlebar windows. Those windows already implement dragging explicitly via `Window::start_window_move`, so disabling AppKit's native movable-titlebar behavior fixes the macOS 27 Beta click delay without affecting other window types. Release Notes: - Fixed delayed clicks in the custom titlebar on macOS 27 Beta.

Anthony Eid committed 4 months ago

Commit ec7c11c1 parent e0f77d12 files · +8 −2Browse files

Unified · Split

2 files
  1. crates/gpui/src/platform.rs +6 −1
  2. crates/zed/src/zed.rs +2 −1
crates/gpui/src/platform.rs+6−1
@@ -1495,7 +1495,12 @@ pub struct WindowOptions { · 1494 unmodified lines
14951495 /// The kind of window to create
14961496 pub kind: WindowKind,
14971497
1498− /// Whether the window should be movable by the user
1498+ /// Whether the window should be movable by the user.
1499+ ///
1500+ /// On macOS 27, custom titlebar windows that implement their own drag behavior
1501+ /// with [`Window::start_window_move`] should set this to `false`; otherwise
1502+ /// AppKit can treat the titlebar region as system-owned and delay clicks
1503+ /// while disambiguating titlebar double-clicks.
14991504 pub is_movable: bool,
15001505
15011506 /// Whether the window should be resizable by the user
crates/zed/src/zed.rs+2−1
@@ -377,7 +377,8 @@ pub fn build_window_options(display_uuid: Option<Uuid>, cx: &mut App) -> WindowO · 376 unmodified lines
377377 focus: false,
378378 show: false,
379379 kind: WindowKind::Normal,
380− is_movable: true,
380+ // Zed handles window movement itself, so disable AppKit's titlebar dragging.
381+ is_movable: false,
381382 display_id: display.map(|display| display.id()),
382383 window_background: cx.theme().window_background_appearance(),
383384 app_id: Some(app_id.to_owned()),