diff options
author | MCApollo <34170230+MCApollo@users.noreply.github.com> | 2019-04-20 20:49:46 -0500 |
---|---|---|
committer | MCApollo <34170230+MCApollo@users.noreply.github.com> | 2019-04-23 20:18:47 -0500 |
commit | 12335518ab39608d58370c85ff9f5384ad2aa5f7 (patch) | |
tree | 352d81f2a2de3f1252af732080ec0fde38c13b4d /homebrew/spatialitegui/patches.sh | |
parent | a2b26ad12d4fa12f0273645caf4be6d0b8b71e7c (diff) |
Ported in the homebrew-marauder for a hacky update/import system.
TODO: Maybe add a license & fix up messy code.
Diffstat (limited to 'homebrew/spatialitegui/patches.sh')
-rwxr-xr-x | homebrew/spatialitegui/patches.sh | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/homebrew/spatialitegui/patches.sh b/homebrew/spatialitegui/patches.sh new file mode 100755 index 000000000..da2f32774 --- /dev/null +++ b/homebrew/spatialitegui/patches.sh @@ -0,0 +1,57 @@ +echo 'Creating brew-patch.diff' +cat << EOF >> brew-patch.diff +For some strange reason, wxWidgets does not take the required steps to register +programs as GUI apps like other toolkits do. This necessitates the creation of +an app bundle on OS X. + +This clever hack sidesteps the headache of packing simple programs into app +bundles: + + https://www.miscdebris.net/blog/2010/03/30/ + solution-for-my-mac-os-x-gui-program-doesnt-get-focus-if-its-outside-an-application-bundle +--- + Main.cpp | 21 +++++++++++++++++++++ + 1 files changed, 21 insertions(+), 0 deletions(-) + +diff --git a/Main.cpp b/Main.cpp +index a857e8a..9c90afb 100644 +--- a/Main.cpp ++++ b/Main.cpp +@@ -71,6 +71,12 @@ + #define unlink _unlink + #endif + ++#ifdef __WXMAC__ ++// Allow the program to run and recieve focus without creating an app bundle. ++#include <Carbon/Carbon.h> ++extern "C" { void CPSEnableForegroundOperation(ProcessSerialNumber* psn); } ++#endif ++ + IMPLEMENT_APP(MyApp) + bool MyApp::OnInit() + { +@@ -86,6 +92,21 @@ IMPLEMENT_APP(MyApp) + frame->Show(true); + SetTopWindow(frame); + frame->LoadConfig(path); ++ ++#ifdef __WXMAC__ ++ // Acquire the necessary resources to run as a GUI app without being inside ++ // an app bundle. ++ // ++ // Credit for this hack goes to: ++ // ++ // https://www.miscdebris.net/blog/2010/03/30/solution-for-my-mac-os-x-gui-program-doesnt-get-focus-if-its-outside-an-application-bundle ++ ProcessSerialNumber psn; ++ ++ GetCurrentProcess( &psn ); ++ CPSEnableForegroundOperation( &psn ); ++ SetFrontProcess( &psn ); ++#endif ++ + return true; + } + +-- +1.7.9 +EOF |