diff --git a/pl/ostype/Darwin.pl b/pl/ostype/Darwin.pl index c786eb8..5d5baab 100644 --- a/pl/ostype/Darwin.pl +++ b/pl/ostype/Darwin.pl @@ -1,7 +1,8 @@ $library_suffix = ".dylib"; set_shared_flag("-dynamiclib"); -use_backend("cocoa"); +#use_backend("cocoa"); +new_object("src/backend/nococoa.m"); add_cflags("-DSTBI_NO_THREAD_LOCALS"); add_ldflags("-framework Cocoa -lobjc"); diff --git a/src/backend/nococoa.m b/src/backend/nococoa.m new file mode 100644 index 0000000..c0e3c70 --- /dev/null +++ b/src/backend/nococoa.m @@ -0,0 +1,8 @@ +#include + +void MwLLNoCocoaErrorMessage() { + NSAlert* alert = [[NSAlert alloc] init]; + [alert setMessageText:@"Milsko applications currently requires XQuartz or cocoa-way. PRs are welcome for anyone who wants to finish the Cocoa backend (prefarably in Objective-C)"]; + [alert addButtonWithTitle:@"Ok"]; + [alert runModal]; +} diff --git a/src/core.c b/src/core.c index 0a125da..76507ea 100644 --- a/src/core.c +++ b/src/core.c @@ -967,7 +967,6 @@ int MwLibraryInit(void) { #ifdef USE_WAYLAND MwLLWaylandCallInit, #endif -/* x11 has higher priority then cocoa until it works */ #ifdef USE_X11 MwLLX11CallInit, #endif @@ -989,6 +988,10 @@ int MwLibraryInit(void) { if(calls[i]() == 0) return 0; } +#ifdef __APPLE__ + void MwNoCocoaErrorMessage(); + MwNoCocoaErrorMessage(); +#else printf("[WARNING] No suitable GUI backend found! Enabled:" #ifdef USE_COCOA " Cocoa" @@ -1006,7 +1009,7 @@ int MwLibraryInit(void) { " ClassicMacOS" #endif "\n"); - +#endif return 1; }