apprt/embedded: support new process alive callback on close

This commit is contained in:
Mitchell Hashimoto
2023-03-25 16:41:18 -07:00
parent 3689f1fe39
commit 86c4a8ed7d
3 changed files with 9 additions and 7 deletions

View File

@@ -60,7 +60,7 @@ extension Ghostty {
read_clipboard_cb: { userdata in AppState.readClipboard(userdata) },
write_clipboard_cb: { userdata, str in AppState.writeClipboard(userdata, string: str) },
new_split_cb: { userdata, direction in AppState.newSplit(userdata, direction: direction) },
close_surface_cb: { userdata in AppState.closeSurface(userdata) },
close_surface_cb: { userdata, processAlive in AppState.closeSurface(userdata, processAlive: processAlive) },
focus_split_cb: { userdata, direction in AppState.focusSplit(userdata, direction: direction) }
)
@@ -132,7 +132,9 @@ extension Ghostty {
])
}
static func closeSurface(_ userdata: UnsafeMutableRawPointer?) {
static func closeSurface(_ userdata: UnsafeMutableRawPointer?, processAlive: Bool) {
// TODO: handle processAlive to show confirmation dialog. We probably want to attach
// it to the notification and let downstream handle it.
guard let surface = self.surfaceUserdata(from: userdata) else { return }
NotificationCenter.default.post(name: Notification.ghosttyCloseSurface, object: surface)
}