mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 11:35:08 -04:00
macOS: Add option for not showing dialogs, and revert the try/catch for showing dialog
This commit is contained in:
parent
f34c725d8c
commit
3ad0966590
@ -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);
|
||||
|
@ -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 setMessageText: titleCF];
|
||||
[alert setInformativeText: msgCF];
|
||||
|
Loading…
x
Reference in New Issue
Block a user