title_bar: Add macOS double-click functionality to title bar (#996) (#1002)

This commit is contained in:
ihavecoke 2025-06-24 07:45:28 +08:00 committed by GitHub
parent 3a6741f990
commit cf24614bd2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -245,6 +245,7 @@ impl ParentElement for TitleBar {
impl RenderOnce for TitleBar {
fn render(mut self, window: &mut Window, cx: &mut App) -> impl IntoElement {
let is_linux = cfg!(target_os = "linux");
let is_macos = cfg!(target_os = "macos");
let paddings = self.base.style().padding.clone();
self.base.style().padding.left = None;
@ -263,6 +264,9 @@ impl RenderOnce for TitleBar {
.when(is_linux, |this| {
this.on_double_click(|_, window, _| window.zoom_window())
})
.when(is_macos, |this| {
this.on_double_click(|_, window, _| window.titlebar_double_click())
})
.child(
h_flex()
.id("bar")