From e78edd9b9417b1cf737e046851e89eb0b5639633 Mon Sep 17 00:00:00 2001 From: whitequark Date: Thu, 2 Jun 2016 02:21:16 +0000 Subject: [PATCH] Cocoa: allow dismissing Message/Error NSAlerts using Escape key. --- src/cocoa/cocoamain.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cocoa/cocoamain.mm b/src/cocoa/cocoamain.mm index 35ce19b..d911ddc 100644 --- a/src/cocoa/cocoamain.mm +++ b/src/cocoa/cocoamain.mm @@ -1092,6 +1092,7 @@ bool TextEditControlIsVisible(void) { void SolveSpace::DoMessageBox(const char *str, int rows, int cols, bool error) { NSAlert *alert = [[NSAlert alloc] init]; [alert setAlertStyle:(error ? NSWarningAlertStyle : NSInformationalAlertStyle)]; + [[alert addButtonWithTitle:@"OK"] setKeyEquivalent: @"\033"]; /* do some additional formatting of the message these are heuristics, but they are made failsafe and lead to nice results. */