mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-27 01:33:57 +00:00
Work around strange SwiftUI behavior in "older" macOSen.
The Quick Terminal would not appear anymore, as somewhere in the framework the Quick Terminal Window's geometry gets corrupted when the window is added to the UI. This works around by caching the windows geometry and reusing it afterwards
This commit is contained in:
committed by
Mitchell Hashimoto
parent
5bff354e96
commit
85cba70c2e
@@ -29,4 +29,14 @@ class QuickTerminalWindow: NSPanel {
|
||||
// We don't want to activate the owning app when quick terminal is triggered.
|
||||
self.styleMask.insert(.nonactivatingPanel)
|
||||
}
|
||||
var initialFrame: NSRect? = nil
|
||||
override func setFrame(_ frameRect: NSRect, display flag: Bool) {
|
||||
// Upon first adding this Window to its host view, older SwiftUI
|
||||
// seems to have a "hiccup" and corrupts the frameRect,
|
||||
// sometimes setting the size to zero, sometimes corrupting it.
|
||||
// If we find we have cached the "initial" frame, use that instead
|
||||
// the propagated one throught the framework
|
||||
super.setFrame(initialFrame ?? frameRect, display: flag)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user