title_bar: Let the title bar own dragging and double clicking (#2667)
Double clicking the title bar zoomed the window even when the two clicks were seconds apart, which is not what a double click should do. ## Cause `WindowOptions::app_owns_titlebar_drag` was never set anywhere in this repo, so it defaulted to `false`. GPUI documents that field as: > Set this to `true` for windows that draw their own titlebar and move the window themselves via `Window::start_window_move`. It marks the whole content view as app-owned titlebar content, so AppKit neither drags the window from the titlebar nor delays titlebar clicks while disambiguating double-clicks (a delay first observed on macOS 27). `TitleBar` is exactly that kind of title bar — it renders itself and calls `start_window_move` — but never claimed the ownership. So on macOS AppKit still treated the title bar as a system window-move region and ran its own `AppleActionOnDoubleClick` handling in parallel with the `on_double_click` handler in `TitleBar`. The zoom came from the system path, which is why it could not be fixed from inside the component. ## Changes - Add `TitleBar::window_options()`, the window options counterpart of the existing `title_bar_options()`. It sets both `titlebar` and `app_owns_titlebar_drag`, so a window that renders a `TitleBar` gets this right by just using it as the base of its `WindowOptions`. - Use it in the stories and all examples that render a `TitleBar`. - `tiles.rs` had an inlined copy of `title_bar_options()`; it now shares the same base. - Drop the `#[cfg(not(target_os = "linux"))]` on the `titlebar` field in `dock.rs`. `appears_transparent` is only read by the macOS and Windows backends, so the cfg produced no behavior difference. - Document both the recommended `window_options()` and the manual `app_owns_titlebar_drag` setup, in English and Chinese. ## Testing Verified on macOS (Darwin 27): two clicks a few seconds apart no longer zoom the window, and a real double click still zooms. AI generated: the patch was written with Claude Code and reviewed by me. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
J
Jason Lee committed
d0c469edd1f5d6824565f70145a25c0bee7c0df8
Parent: 3cb3cc1
Committed by GitHub <noreply@github.com>
on 8/10/2026, 7:49:49 AM