From a51f8532a7a9ce3fb1f8c113280ecfafc93f0124 Mon Sep 17 00:00:00 2001 From: TheUnknownHacker Date: Wed, 17 Jun 2026 23:30:31 +1000 Subject: [PATCH] add proper macos titlebar support Override sendEvent in MainFlutterWindow so a double-click in the top title-bar strip performs the native window action, honoring the "Double-click a window's title bar to" system preference (zoom, minimize, or do nothing). Needed because the full-size content view with a hidden title bar means the Flutter view covers the native title bar. --- macos/Runner/MainFlutterWindow.swift | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/macos/Runner/MainFlutterWindow.swift b/macos/Runner/MainFlutterWindow.swift index 2391ce465..62c176734 100644 --- a/macos/Runner/MainFlutterWindow.swift +++ b/macos/Runner/MainFlutterWindow.swift @@ -22,4 +22,23 @@ class MainFlutterWindow: NSWindow { super.awakeFromNib() } + + override func sendEvent(_ event: NSEvent) { + if event.type == .leftMouseDown, event.clickCount == 2, !styleMask.contains(.fullScreen) { + let titleBarHeight: CGFloat = 35 + if event.locationInWindow.y >= frame.height - titleBarHeight { + switch UserDefaults.standard.string(forKey: "AppleActionOnDoubleClick") { + case "Minimize": + performMiniaturize(nil) + return + case "None": + break + default: + performZoom(nil) + return + } + } + } + super.sendEvent(event) + } }