diff --git a/src/_WindowBase.h b/src/_WindowBase.h index e6e1796fc..d59a67a7e 100644 --- a/src/_WindowBase.h +++ b/src/_WindowBase.h @@ -15,6 +15,7 @@ int Display_ScaleY(int y) { return (int)(y * DisplayInfo.ScaleY); } static int cursorPrevX, cursorPrevY; static cc_bool cursorVisible = true; +static cc_bool showDialogs = true; /* Gets the position of the cursor in screen or window coordinates */ static void Cursor_GetRawPos(int* x, int* y); /* Sets whether the cursor is visible when over this window */ @@ -64,6 +65,7 @@ static void ShowDialogCore(const char* title, const char* msg); void Window_ShowDialog(const char* title, const char* msg) { /* Ensure cursor is usable while showing message box */ cc_bool rawMode = Input_RawMode; + if (!showDialogs) return; if (rawMode) Window_DisableRawMouse(); ShowDialogCore(title, msg); diff --git a/src/interop_cocoa.m b/src/interop_cocoa.m index e40456874..3c43653e3 100644 --- a/src/interop_cocoa.m +++ b/src/interop_cocoa.m @@ -150,6 +150,7 @@ static void LogUnhandledNSErrors(NSException* ex) { static NSAutoreleasePool* pool; void Window_Init(void) { NSSetUncaughtExceptionHandler(LogUnhandledNSErrors); + showDialogs = Options_GetBool("show-dialogs", true); // https://www.cocoawithlove.com/2009/01/demystifying-nsapplication-by.html pool = [[NSAutoreleasePool alloc] init]; @@ -546,13 +547,8 @@ void ShowDialogCore(const char* title, const char* msg) { titleCF = CFStringCreateWithCString(NULL, title, kCFStringEncodingASCII); msgCF = CFStringCreateWithCString(NULL, msg, kCFStringEncodingASCII); - // backwards compatible @try @catch - NS_DURING { - alert = [NSAlert alloc]; - alert = [alert init]; - } NS_HANDLER { - LogUnhandledNSErrors(localException); - } NS_ENDHANDLER + alert = [NSAlert alloc]; + alert = [alert init]; [alert setMessageText: titleCF]; [alert setInformativeText: msgCF];