From f9f13bf0221ff1d15dc79baffb380e13d51e6d92 Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Wed, 3 Oct 2018 05:51:37 -0700 Subject: [PATCH 1/5] Dispatch popup dialogues to main thread --- src/oneshot.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/oneshot.cpp b/src/oneshot.cpp index 9824f06..102ff87 100644 --- a/src/oneshot.cpp +++ b/src/oneshot.cpp @@ -31,6 +31,7 @@ #ifdef __APPLE__ #define OS_OSX + #include #else #define OS_LINUX #include @@ -503,7 +504,7 @@ bool Oneshot::msgbox(int type, const char *body, const char *title) // Messagebox data SDL_MessageBoxData data; - data.window = NULL;//p->window; + data.window = NULL; //p->window; data.colorScheme = 0; data.title = title; data.message = body; @@ -556,9 +557,22 @@ bool Oneshot::msgbox(int type, const char *body, const char *title) #ifdef OS_W32 PlaySoundW((LPCWSTR)sound, NULL, SND_ALIAS_ID | SND_ASYNC); #endif - int button; - SDL_ShowMessageBox(&data, &button); - return button ? true : false; + int *button; + + #ifdef OS_OSX + // Message boxes and UI changes must be performed from the main thread on macOS Mojave and above. + // This block ensures the message box will show from the main thread. + dispatch_sync(dispatch_get_main_queue(), + ^{ SDL_ShowMessageBox(&data, button); } + ); + + // dispatch_block_wait(dispatch_get_main_queue(), DISPATCH_TIME_FOREVER); + *button = 1; // XXX Setting the button's value doesn't seem to work. + #else + SDL_ShowMessageBox(&data, button); + #endif + + return (*button) ? true : false; } std::string Oneshot::textinput(const char* prompt, int char_limit, const char* fontName) { From 7f9cf820198f676c7a5dfba3ff208bc8a41a7ee3 Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Thu, 4 Oct 2018 11:32:38 -0700 Subject: [PATCH 2/5] Enable Build for Steam by default --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e17b062..fd8aa2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ conan_basic_setup() ## Setup options ## -option(STEAM "Build for Steam" OFF) +option(STEAM "Build for Steam" ON) ## Misc setup ## From e9908c30ec7d2c4871109cb5894844968b302619 Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Thu, 4 Oct 2018 11:32:54 -0700 Subject: [PATCH 3/5] Allow for swapping between QMake and Conan in macOS build script --- make-oneshot-mac.command | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/make-oneshot-mac.command b/make-oneshot-mac.command index 3b11bed..4107538 100755 --- a/make-oneshot-mac.command +++ b/make-oneshot-mac.command @@ -15,17 +15,24 @@ cyan="\033[1;36m" # Cyan - Bold green="\033[1;32m" # Green - Bold color_reset="\033[0m" # Reset Colors +use_qmake=True + echo "${white}Compiling ${bold}SyngleChance v${mac_version} ${white}engine for macOS...${color_reset}\n" # Generate makefile and build main + journal -echo "-> ${cyan}Generate makefile...${color_reset}" -qmake MRIVERSION=2.5 -echo "-> ${cyan}Compile engine...${color_reset}" -make -j${make_threads} -echo "-> ${cyan}Compile steamshim...${color_reset}" -cd steamshim_parent -HOST=osx make -j${make_threads} -cd .. +if [[$use_qmake == True]] + then + echo "-> ${cyan}Generate makefile...${color_reset}" + qmake MRIVERSION=2.5 + echo "-> ${cyan}Compile engine...${color_reset}" + make -j${make_threads} + echo "-> ${cyan}Compile steamshim...${color_reset}" + cd steamshim_parent + HOST=osx make -j${make_threads} + cd .. +else + echo "${bold}WARNING: Conan/CMake method not ready yet.${color_reset}" +fi echo "-> ${cyan}Compile journal...${color_reset}" pyinstaller journal/unix/journal.spec --onefile --windowed From 1c9c3aca2c121740c927d46246f8f58eaed0a451 Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Thu, 4 Oct 2018 17:50:49 -0700 Subject: [PATCH 4/5] Fix make script --- make-oneshot-mac.command | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make-oneshot-mac.command b/make-oneshot-mac.command index 4107538..d98d1fc 100755 --- a/make-oneshot-mac.command +++ b/make-oneshot-mac.command @@ -20,7 +20,7 @@ use_qmake=True echo "${white}Compiling ${bold}SyngleChance v${mac_version} ${white}engine for macOS...${color_reset}\n" # Generate makefile and build main + journal -if [[$use_qmake == True]] +if [[ $use_qmake == True ]] then echo "-> ${cyan}Generate makefile...${color_reset}" qmake MRIVERSION=2.5 From 88c3867ff5861f05ee5fc733a37bcfb0c8df778c Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Thu, 4 Oct 2018 17:51:00 -0700 Subject: [PATCH 5/5] Finish Mojave fixes --- src/oneshot.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/oneshot.cpp b/src/oneshot.cpp index 102ff87..44eeb8a 100644 --- a/src/oneshot.cpp +++ b/src/oneshot.cpp @@ -557,22 +557,21 @@ bool Oneshot::msgbox(int type, const char *body, const char *title) #ifdef OS_W32 PlaySoundW((LPCWSTR)sound, NULL, SND_ALIAS_ID | SND_ASYNC); #endif - int *button; + int button; #ifdef OS_OSX + int *btn = &button; + // Message boxes and UI changes must be performed from the main thread on macOS Mojave and above. // This block ensures the message box will show from the main thread. dispatch_sync(dispatch_get_main_queue(), - ^{ SDL_ShowMessageBox(&data, button); } + ^{ SDL_ShowMessageBox(&data, btn); } ); - - // dispatch_block_wait(dispatch_get_main_queue(), DISPATCH_TIME_FOREVER); - *button = 1; // XXX Setting the button's value doesn't seem to work. #else - SDL_ShowMessageBox(&data, button); + SDL_ShowMessageBox(&data, &button); #endif - return (*button) ? true : false; + return button ? true : false; } std::string Oneshot::textinput(const char* prompt, int char_limit, const char* fontName) {