fix: exit non-native fullscreen on close (#7525)
Fixes https://github.com/ghostty-org/ghostty/discussions/7159.pull/7527/head
commit
6db455eee5
|
|
@ -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 }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue