macos: only modify style mask, don't overwrite

Fixes #784

The issue before was we were removing the fullscreen style which was
triggering a Cocoa assertion.
This commit is contained in:
Mitchell Hashimoto
2023-11-02 22:12:52 -07:00
parent 60713b46e9
commit 833e1a5329

View File

@ -28,13 +28,6 @@ class TerminalController: NSWindowController, NSWindowDelegate, TerminalViewDele
/// True when an alert is active so we don't overlap multiple.
private var alert: NSAlert? = nil
/// The style mask to use for the new window
private var styleMask: NSWindow.StyleMask {
var mask: NSWindow.StyleMask = [.resizable, .closable, .miniaturizable]
if (ghostty.windowDecorations) { mask.insert(.titled) }
return mask
}
init(_ ghostty: Ghostty.AppState, withBaseConfig base: Ghostty.SurfaceConfiguration? = nil) {
self.ghostty = ghostty
super.init(window: nil)
@ -76,7 +69,9 @@ class TerminalController: NSWindowController, NSWindowDelegate, TerminalViewDele
override func windowDidLoad() {
guard let window = window else { return }
window.styleMask = self.styleMask
// If window decorations are disabled, remove our title
if (!ghostty.windowDecorations) { window.styleMask.remove(.titled) }
// Terminals typically operate in sRGB color space and macOS defaults
// to "native" which is typically P3. There is a lot more resources