Skip to content

Instantly share code, notes, and snippets.

@khenriks
Last active August 29, 2015 13:57
Show Gist options
  • Save khenriks/9442946 to your computer and use it in GitHub Desktop.
Save khenriks/9442946 to your computer and use it in GitHub Desktop.
diff --git a/src/wxterminal/wxt_gui.cpp b/src/wxterminal/wxt_gui.cpp
index b3563b5..94b59d7 100644
--- a/src/wxterminal/wxt_gui.cpp
+++ b/src/wxterminal/wxt_gui.cpp
@@ -237,12 +237,6 @@ IMPLEMENT_APP_NO_MAIN(wxtApp)
bool wxtApp::OnInit()
{
-#ifdef __WXMAC__
- ProcessSerialNumber PSN;
- GetCurrentProcess(&PSN);
- TransformProcessType(&PSN, kProcessTransformToForegroundApplication);
-#endif
-
/* Usually wxWidgets apps create their main window here.
* However, in the context of multiple plot windows, the same code is written in wxt_init().
* So, to avoid duplication of the code, we do only what is strictly necessary.*/
@@ -1578,6 +1572,12 @@ void wxt_init()
if ( wxt_status == STATUS_UNINITIALIZED ) {
FPRINTF((stderr,"First Init\n"));
+#ifdef __WXMAC__
+ ProcessSerialNumber psn = { 0, kCurrentProcess };
+ TransformProcessType(&psn, kProcessTransformToForegroundApplication);
+ SetFrontProcess(&psn);
+#endif
+
#ifdef __WXMSW__
/* the following is done in wxEntry() with wxMSW only */
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment