mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
macos: add needsConfirmQuit helper to surface and split structs
This commit is contained in:
@ -97,6 +97,22 @@ extension Ghostty {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns true if any surface in the split stack requires quit confirmation.
|
||||||
|
func needsConfirmQuit() -> Bool {
|
||||||
|
switch (self) {
|
||||||
|
case .noSplit(let leaf):
|
||||||
|
return leaf.surface.needsConfirmQuit
|
||||||
|
|
||||||
|
case .horizontal(let container):
|
||||||
|
return container.topLeft.needsConfirmQuit() ||
|
||||||
|
container.bottomRight.needsConfirmQuit()
|
||||||
|
|
||||||
|
case .vertical(let container):
|
||||||
|
return container.topLeft.needsConfirmQuit() ||
|
||||||
|
container.bottomRight.needsConfirmQuit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns true if the split tree contains the given view.
|
/// Returns true if the split tree contains the given view.
|
||||||
func contains(view: SurfaceView) -> Bool {
|
func contains(view: SurfaceView) -> Bool {
|
||||||
switch (self) {
|
switch (self) {
|
||||||
|
@ -252,6 +252,13 @@ extension Ghostty {
|
|||||||
// then the view is moved to a new window.
|
// then the view is moved to a new window.
|
||||||
var initialSize: NSSize? = nil
|
var initialSize: NSSize? = nil
|
||||||
|
|
||||||
|
// Returns true if quit confirmation is required for this surface to
|
||||||
|
// exit safely.
|
||||||
|
var needsConfirmQuit: Bool {
|
||||||
|
guard let surface = self.surface else { return false }
|
||||||
|
return ghostty_surface_needs_confirm_quit(surface)
|
||||||
|
}
|
||||||
|
|
||||||
// Returns the inspector instance for this surface, or nil if the
|
// Returns the inspector instance for this surface, or nil if the
|
||||||
// surface has been closed.
|
// surface has been closed.
|
||||||
var inspector: ghostty_inspector_t? {
|
var inspector: ghostty_inspector_t? {
|
||||||
|
Reference in New Issue
Block a user