From f386f12e8a9dfe242a6ff58ec7a046e9dcb3b144 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 29 Sep 2023 12:05:24 -0700 Subject: [PATCH] macos: safeAreaInsets.top includes menu --- macos/Sources/Helpers/FullScreenHandler.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/macos/Sources/Helpers/FullScreenHandler.swift b/macos/Sources/Helpers/FullScreenHandler.swift index 2430ca942..28bf83149 100644 --- a/macos/Sources/Helpers/FullScreenHandler.swift +++ b/macos/Sources/Helpers/FullScreenHandler.swift @@ -120,8 +120,11 @@ class FullScreenHandler { var previousTabGroup: NSWindowTabGroup? if (subtractMenu) { if let menuHeight = NSApp.mainMenu?.menuBarHeight { var padding: CGFloat = 0 - if #available(macOS 12, *) { - padding = screen.safeAreaInsets.top; + + // Detect the notch. If there is a safe area on top it includes the + // menu height as a safe area so we also subtract that from it. + if (screen.safeAreaInsets.top > 0) { + padding = screen.safeAreaInsets.top - menuHeight; } return NSMakeRect(