apprt/embedded: hook up paste confirmation

This commit is contained in:
Mitchell Hashimoto
2023-11-05 09:20:16 -08:00
parent 5dac8fba96
commit ef44551522
8 changed files with 149 additions and 30 deletions

View File

@@ -6,9 +6,15 @@ import GhosttyKit
class PasteProtectionController: NSWindowController {
override var windowNibName: NSNib.Name? { "PasteProtection" }
let surface: ghostty_surface_t
let contents: String
let state: UnsafeMutableRawPointer?
weak private var delegate: PasteProtectionViewDelegate? = nil
init(delegate: PasteProtectionViewDelegate) {
init(surface: ghostty_surface_t, contents: String, state: UnsafeMutableRawPointer?, delegate: PasteProtectionViewDelegate) {
self.surface = surface
self.contents = contents
self.state = state
self.delegate = delegate
super.init(window: nil)
}
@@ -22,7 +28,7 @@ class PasteProtectionController: NSWindowController {
override func windowDidLoad() {
guard let window = window else { return }
window.contentView = NSHostingView(rootView: PasteProtectionView(
contents: "Hello\nWorld",
contents: contents,
delegate: delegate
))
}