mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-18 12:05:14 -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 int cursorPrevX, cursorPrevY;
|
||||||
static cc_bool cursorVisible = true;
|
static cc_bool cursorVisible = true;
|
||||||
|
static cc_bool showDialogs = true;
|
||||||
/* Gets the position of the cursor in screen or window coordinates */
|
/* Gets the position of the cursor in screen or window coordinates */
|
||||||
static void Cursor_GetRawPos(int* x, int* y);
|
static void Cursor_GetRawPos(int* x, int* y);
|
||||||
/* Sets whether the cursor is visible when over this window */
|
/* 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) {
|
void Window_ShowDialog(const char* title, const char* msg) {
|
||||||
/* Ensure cursor is usable while showing message box */
|
/* Ensure cursor is usable while showing message box */
|
||||||
cc_bool rawMode = Input_RawMode;
|
cc_bool rawMode = Input_RawMode;
|
||||||
|
if (!showDialogs) return;
|
||||||
|
|
||||||
if (rawMode) Window_DisableRawMouse();
|
if (rawMode) Window_DisableRawMouse();
|
||||||
ShowDialogCore(title, msg);
|
ShowDialogCore(title, msg);
|
||||||
|
@ -150,6 +150,7 @@ static void LogUnhandledNSErrors(NSException* ex) {
|
|||||||
static NSAutoreleasePool* pool;
|
static NSAutoreleasePool* pool;
|
||||||
void Window_Init(void) {
|
void Window_Init(void) {
|
||||||
NSSetUncaughtExceptionHandler(LogUnhandledNSErrors);
|
NSSetUncaughtExceptionHandler(LogUnhandledNSErrors);
|
||||||
|
showDialogs = Options_GetBool("show-dialogs", true);
|
||||||
|
|
||||||
// https://www.cocoawithlove.com/2009/01/demystifying-nsapplication-by.html
|
// https://www.cocoawithlove.com/2009/01/demystifying-nsapplication-by.html
|
||||||
pool = [[NSAutoreleasePool alloc] init];
|
pool = [[NSAutoreleasePool alloc] init];
|
||||||
@ -546,13 +547,8 @@ void ShowDialogCore(const char* title, const char* msg) {
|
|||||||
titleCF = CFStringCreateWithCString(NULL, title, kCFStringEncodingASCII);
|
titleCF = CFStringCreateWithCString(NULL, title, kCFStringEncodingASCII);
|
||||||
msgCF = CFStringCreateWithCString(NULL, msg, kCFStringEncodingASCII);
|
msgCF = CFStringCreateWithCString(NULL, msg, kCFStringEncodingASCII);
|
||||||
|
|
||||||
// backwards compatible @try @catch
|
alert = [NSAlert alloc];
|
||||||
NS_DURING {
|
alert = [alert init];
|
||||||
alert = [NSAlert alloc];
|
|
||||||
alert = [alert init];
|
|
||||||
} NS_HANDLER {
|
|
||||||
LogUnhandledNSErrors(localException);
|
|
||||||
} NS_ENDHANDLER
|
|
||||||
|
|
||||||
[alert setMessageText: titleCF];
|
[alert setMessageText: titleCF];
|
||||||
[alert setInformativeText: msgCF];
|
[alert setInformativeText: msgCF];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user