ignore process serial number command line argument (-psn) passed to application
when launched from the Finder git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15282 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -690,19 +690,16 @@ int WXDLLEXPORT wxEntryStart( int argc, char *argv[] )
|
|||||||
return wxApp::Initialize();
|
return wxApp::Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int WXDLLEXPORT wxEntryInitGui()
|
int WXDLLEXPORT wxEntryInitGui()
|
||||||
{
|
{
|
||||||
return wxTheApp->OnInitGui();
|
return wxTheApp->OnInitGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WXDLLEXPORT wxEntryCleanup()
|
void WXDLLEXPORT wxEntryCleanup()
|
||||||
{
|
{
|
||||||
wxApp::CleanUp();
|
wxApp::CleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int wxEntry( int argc, char *argv[] , bool enterLoop )
|
int wxEntry( int argc, char *argv[] , bool enterLoop )
|
||||||
{
|
{
|
||||||
gCurrentResource = CurResFile() ;
|
gCurrentResource = CurResFile() ;
|
||||||
@@ -734,7 +731,22 @@ int wxEntry( int argc, char *argv[] , bool enterLoop )
|
|||||||
|
|
||||||
wxCHECK_MSG( wxTheApp, 0, wxT("You have to define an instance of wxApp!") );
|
wxCHECK_MSG( wxTheApp, 0, wxT("You have to define an instance of wxApp!") );
|
||||||
|
|
||||||
#ifndef __DARWIN__
|
#ifdef __DARWIN__
|
||||||
|
// Mac OS X passes a process serial number command line argument when
|
||||||
|
// the application is launched from the Finder. This argument must be
|
||||||
|
// removed from the command line arguments before being handled by the
|
||||||
|
// application (otherwise applications would need to handle it)
|
||||||
|
|
||||||
|
if (argc > 1) {
|
||||||
|
char buf[6] = "";
|
||||||
|
strncpy(buf, argv[1], 5);
|
||||||
|
|
||||||
|
if (strcmp(buf, "-psn_") == 0) {
|
||||||
|
// assume the argument is always the only one and remove it
|
||||||
|
--argc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
argc = 0 ; // currently we don't support files as parameters
|
argc = 0 ; // currently we don't support files as parameters
|
||||||
#endif
|
#endif
|
||||||
// we could try to get the open apple events here to adjust argc and argv better
|
// we could try to get the open apple events here to adjust argc and argv better
|
||||||
@@ -745,7 +757,6 @@ int wxEntry( int argc, char *argv[] , bool enterLoop )
|
|||||||
// GUI-specific initialization, such as creating an app context.
|
// GUI-specific initialization, such as creating an app context.
|
||||||
wxEntryInitGui();
|
wxEntryInitGui();
|
||||||
|
|
||||||
|
|
||||||
// Here frames insert themselves automatically
|
// Here frames insert themselves automatically
|
||||||
// into wxTopLevelWindows by getting created
|
// into wxTopLevelWindows by getting created
|
||||||
// in OnInit().
|
// in OnInit().
|
||||||
|
@@ -690,19 +690,16 @@ int WXDLLEXPORT wxEntryStart( int argc, char *argv[] )
|
|||||||
return wxApp::Initialize();
|
return wxApp::Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int WXDLLEXPORT wxEntryInitGui()
|
int WXDLLEXPORT wxEntryInitGui()
|
||||||
{
|
{
|
||||||
return wxTheApp->OnInitGui();
|
return wxTheApp->OnInitGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WXDLLEXPORT wxEntryCleanup()
|
void WXDLLEXPORT wxEntryCleanup()
|
||||||
{
|
{
|
||||||
wxApp::CleanUp();
|
wxApp::CleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int wxEntry( int argc, char *argv[] , bool enterLoop )
|
int wxEntry( int argc, char *argv[] , bool enterLoop )
|
||||||
{
|
{
|
||||||
gCurrentResource = CurResFile() ;
|
gCurrentResource = CurResFile() ;
|
||||||
@@ -734,7 +731,22 @@ int wxEntry( int argc, char *argv[] , bool enterLoop )
|
|||||||
|
|
||||||
wxCHECK_MSG( wxTheApp, 0, wxT("You have to define an instance of wxApp!") );
|
wxCHECK_MSG( wxTheApp, 0, wxT("You have to define an instance of wxApp!") );
|
||||||
|
|
||||||
#ifndef __DARWIN__
|
#ifdef __DARWIN__
|
||||||
|
// Mac OS X passes a process serial number command line argument when
|
||||||
|
// the application is launched from the Finder. This argument must be
|
||||||
|
// removed from the command line arguments before being handled by the
|
||||||
|
// application (otherwise applications would need to handle it)
|
||||||
|
|
||||||
|
if (argc > 1) {
|
||||||
|
char buf[6] = "";
|
||||||
|
strncpy(buf, argv[1], 5);
|
||||||
|
|
||||||
|
if (strcmp(buf, "-psn_") == 0) {
|
||||||
|
// assume the argument is always the only one and remove it
|
||||||
|
--argc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
argc = 0 ; // currently we don't support files as parameters
|
argc = 0 ; // currently we don't support files as parameters
|
||||||
#endif
|
#endif
|
||||||
// we could try to get the open apple events here to adjust argc and argv better
|
// we could try to get the open apple events here to adjust argc and argv better
|
||||||
@@ -745,7 +757,6 @@ int wxEntry( int argc, char *argv[] , bool enterLoop )
|
|||||||
// GUI-specific initialization, such as creating an app context.
|
// GUI-specific initialization, such as creating an app context.
|
||||||
wxEntryInitGui();
|
wxEntryInitGui();
|
||||||
|
|
||||||
|
|
||||||
// Here frames insert themselves automatically
|
// Here frames insert themselves automatically
|
||||||
// into wxTopLevelWindows by getting created
|
// into wxTopLevelWindows by getting created
|
||||||
// in OnInit().
|
// in OnInit().
|
||||||
|
Reference in New Issue
Block a user