Run a virtual iPhone on an Apple Silicon Mac.
Swift
Let Esc cancel the stop question in the VM window
Jackyb3e7b16b27a6
diff --git a/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/VPhoneAlert.swift b/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/VPhoneAlert.swiftindex 35269ac5..f14d0610 100644--- a/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/VPhoneAlert.swift+++ b/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/VPhoneAlert.swift@@ -66,7 +66,12 @@ enum VPhoneAlert {alert.informativeText = VPhoneLocalization.text(message)alert.alertStyle = stylefor button in buttons {- alert.addButton(withTitle: VPhoneLocalization.text(button))+ let added = alert.addButton(withTitle: VPhoneLocalization.text(button))+ // AppKit gives Esc to a button only when its title is the English+ // "Cancel", so a localized one has to be bound here.+ if button == "Cancel" {+ added.keyEquivalent = "\u{1b}"+ }}return alert}diff --git a/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/VPhoneApplication.swift b/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/VPhoneApplication.swiftindex e0dad034..47e6a150 100644--- a/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/VPhoneApplication.swift+++ b/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/VPhoneApplication.swift@@ -35,7 +35,10 @@ final class VPhoneApplication: NSApplication {private static let escapeKeyCode: UInt16 = 53override func sendEvent(_ event: NSEvent) {+ // While a sheet is up, its keys are its own: Esc must reach its+ // Cancel button, not the guest's back gesture.guard event.type == .keyDown || event.type == .keyUp || event.type == .flagsChanged,+ event.window?.attachedSheet == nil,let view = event.window?.firstResponder as? VPhoneVirtualMachineViewelse {super.sendEvent(event)