fix: exit non-native fullscreen on close

pull/7525/head
Francisco Giordano 2025-06-01 12:06:47 -03:00 committed by Mitchell Hashimoto
parent 1ff9162598
commit 9008e21637
1 changed files with 20 additions and 0 deletions

View File

@ -150,6 +150,26 @@ class NonNativeFullscreen: FullscreenBase, FullscreenStyle {
private var savedState: SavedState? private var savedState: SavedState?
required init?(_ window: NSWindow) {
super.init(window)
NotificationCenter.default.addObserver(
self,
selector: #selector(windowWillCloseNotification),
name: NSWindow.willCloseNotification,
object: window)
}
deinit {
NotificationCenter.default.removeObserver(self)
}
@objc private func windowWillCloseNotification(_ notification: Notification) {
// When the window closes we need to explicitly exit non-native fullscreen
// otherwise some state like the menu bar can remain hidden.
exit()
}
func enter() { func enter() {
// If we are in fullscreen we don't do it again. // If we are in fullscreen we don't do it again.
guard !isFullscreen else { return } guard !isFullscreen else { return }