Skip to content

gpui: Fix title bar clicks being delayed on macOS 27 - #58947

Merged
Anthony-Eid merged 2 commits into
mainfrom
fix-macos-27-titlebar-click-delay
Jun 9, 2026
Merged

gpui: Fix title bar clicks being delayed on macOS 27#58947
Anthony-Eid merged 2 commits into
mainfrom
fix-macos-27-titlebar-click-delay

Conversation

@Anthony-Eid

@Anthony-Eid Anthony-Eid commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Fixes a macOS 27 beta regression where clicks on custom titlebar controls were delayed by the system double-click interval.

After updating to macOS 27 dev beta, I noticed that our titlebar buttons had a delay before click events took effect. After some digging, I discovered that AppKit can treat that titlebar region as system-owned and delay click delivery while waiting to disambiguate double-clicks. I noticed that Slack had titlebar buttons that weren't affected by the double-click disambiguation delay, so I had Claude dig through the Chromium/Electron codebase to discover what they did differently.

Chromium uses a private AppKit SPI, _opaqueRectForWindowMoveWhenInTitlebar, that allows them to set what regions should be treated as owned by a view vs. owned by AppKit. My fix uses the same API and returns the view bounds when NSWindowStyleMask::NSFullSizeContentViewWindowMask is set, which happens when a GPUI app uses a full-size content view for a custom titlebar. Otherwise, we return bounds of NSRect::new(NSPoint::new(0., 0.), NSSize::new(0., 0.)) so apps using macOS's native titlebar still work as expected.

Before

Screen.Recording.2026-06-09.at.2.00.10.PM.mov

After

Screen.Recording.2026-06-09.at.2.01.11.PM.mov

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content adheres to Zed's UI standards (UX/UI and icon guidelines)
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Release Notes:

  • Fixed clicks on titlebar controls being delayed on the macOS 27 beta.

On macOS 27, the system title bar machinery holds single clicks in the
title bar region for the double-click interval before delivering them,
delaying clicks on controls in our custom title bar. Implement the same
SPI Chromium uses (_opaqueRectForWindowMoveWhenInTitlebar) to declare
the GPUI view's content opaque for window-move purposes, which scopes
the system's title bar gesture handling away from our windows.
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jun 9, 2026
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label Jun 9, 2026
@Anthony-Eid
Anthony-Eid added this pull request to the merge queue Jun 9, 2026
Merged via the queue into main with commit c8554b4 Jun 9, 2026
44 checks passed
@Anthony-Eid
Anthony-Eid deleted the fix-macos-27-titlebar-click-delay branch June 9, 2026 19:04
cole-miller added a commit that referenced this pull request Jun 12, 2026
#59214) (cherry-pick to preview) (#59216)

Cherry-pick of #59214 to preview

----
This reverts commit c8554b4.

Reverting this because it broke dragging the settings UI window.

Closes #59163

Release Notes:

- Fixed not being able to drag the settings UI window on macOS.

Co-authored-by: Cole Miller <cole@zed.dev>
pull Bot pushed a commit to kp-forks/zed that referenced this pull request Jun 12, 2026
…ustries#58947)" (zed-industries#59214)

This reverts commit c8554b4.

Reverting this because it broke dragging the settings UI window.

Closes zed-industries#59163

Release Notes:

- Fixed not being able to drag the settings UI window on macOS.
This was referenced Jun 18, 2026
ypatodkar pushed a commit to ypatodkar/zed that referenced this pull request Jun 25, 2026
## 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, zed-industries#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 zed-industries#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.
jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 2026
…58947)

Fixes a macOS 27 beta regression where clicks on custom titlebar
controls were delayed by the system double-click interval.

After updating to macOS 27 dev beta, I noticed that our titlebar buttons
had a delay before click events took effect. After some digging, I
discovered that AppKit can treat that titlebar region as system-owned
and delay click delivery while waiting to disambiguate double-clicks. I
noticed that Slack had titlebar buttons that weren't affected by the
double-click disambiguation delay, so I had Claude dig through the
Chromium/Electron codebase to discover what they did differently.

Chromium uses a private AppKit SPI,
`_opaqueRectForWindowMoveWhenInTitlebar`, that allows them to set what
regions should be treated as owned by a view vs. owned by AppKit. My fix
uses the same API and returns the view bounds when
`NSWindowStyleMask::NSFullSizeContentViewWindowMask` is set, which
happens when a GPUI app uses a full-size content view for a custom
titlebar. Otherwise, we return bounds of `NSRect::new(NSPoint::new(0.,
0.), NSSize::new(0., 0.))` so apps using macOS's native titlebar still
work as expected.

### Before


https://github.com/user-attachments/assets/ba9e0d2d-b85c-4d98-bc7d-bea00368d9cf

### After 


https://github.com/user-attachments/assets/b78bd7d4-6b43-48d3-a615-2c7a29e32e71


Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

-  Fixed clicks on titlebar controls being delayed on the macOS 27 beta.
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
…58947)

Fixes a macOS 27 beta regression where clicks on custom titlebar
controls were delayed by the system double-click interval.

After updating to macOS 27 dev beta, I noticed that our titlebar buttons
had a delay before click events took effect. After some digging, I
discovered that AppKit can treat that titlebar region as system-owned
and delay click delivery while waiting to disambiguate double-clicks. I
noticed that Slack had titlebar buttons that weren't affected by the
double-click disambiguation delay, so I had Claude dig through the
Chromium/Electron codebase to discover what they did differently.

Chromium uses a private AppKit SPI,
`_opaqueRectForWindowMoveWhenInTitlebar`, that allows them to set what
regions should be treated as owned by a view vs. owned by AppKit. My fix
uses the same API and returns the view bounds when
`NSWindowStyleMask::NSFullSizeContentViewWindowMask` is set, which
happens when a GPUI app uses a full-size content view for a custom
titlebar. Otherwise, we return bounds of `NSRect::new(NSPoint::new(0.,
0.), NSSize::new(0., 0.))` so apps using macOS's native titlebar still
work as expected.

### Before


https://github.com/user-attachments/assets/ba9e0d2d-b85c-4d98-bc7d-bea00368d9cf

### After 


https://github.com/user-attachments/assets/b78bd7d4-6b43-48d3-a615-2c7a29e32e71


Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

-  Fixed clicks on titlebar controls being delayed on the macOS 27 beta.
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
…ustries#58947)" (zed-industries#59214) (cherry-pick to preview) (zed-industries#59216)

Cherry-pick of zed-industries#59214 to preview

----
This reverts commit c5feb35.

Reverting this because it broke dragging the settings UI window.

Closes zed-industries#59163

Release Notes:

- Fixed not being able to drag the settings UI window on macOS.

Co-authored-by: Cole Miller <cole@zed.dev>
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
…ustries#58947)" (zed-industries#59214)

This reverts commit c5feb35.

Reverting this because it broke dragging the settings UI window.

Closes zed-industries#59163

Release Notes:

- Fixed not being able to drag the settings UI window on macOS.
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
## 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, zed-industries#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 zed-industries#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants