X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/764566762c65cd4b65b139121221aa81f652a80f..fe1bdf10a61ddc1f3455e5a9a22ca04a8f38eec2:/src/common/appcmn.cpp diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp index 84f193af62..b1ab25eaf1 100644 --- a/src/common/appcmn.cpp +++ b/src/common/appcmn.cpp @@ -166,7 +166,7 @@ bool wxAppBase::OnInit() OnInitCmdLine(parser); bool cont; - switch ( parser.Parse() ) + switch ( parser.Parse(FALSE /* don't show usage */) ) { case -1: cont = OnCmdLineHelp(parser); @@ -192,6 +192,7 @@ bool wxAppBase::OnInit() #define OPTION_VERBOSE _T("verbose") #define OPTION_THEME _T("theme") +#define OPTION_MODE _T("mode") void wxAppBase::OnInitCmdLine(wxCmdLineParser& parser) { @@ -226,6 +227,19 @@ void wxAppBase::OnInitCmdLine(wxCmdLineParser& parser) }, #endif // __WXUNIVERSAL__ +#if defined(__WXMGL__) + // VS: this is not specific to wxMGL, all fullscreen (framebuffer) ports + // should provide this option. That's why it is in common/appcmn.cpp + // and not mgl/app.cpp + { + wxCMD_LINE_OPTION, + _T(""), + OPTION_MODE, + gettext_noop("specify display mode to use (e.g. 640x480-16)"), + wxCMD_LINE_VAL_STRING + }, +#endif // __WXMGL__ + // terminator { wxCMD_LINE_NONE } }; @@ -258,6 +272,23 @@ bool wxAppBase::OnCmdLineParsed(wxCmdLineParser& parser) } #endif // __WXUNIVERSAL__ +#if defined(__WXMGL__) + wxString modeDesc; + if ( parser.Found(OPTION_MODE, &modeDesc) ) + { + unsigned w, h, bpp; + if ( wxSscanf(modeDesc.c_str(), _T("%ux%u-%u"), &w, &h, &bpp) != 3 ) + { + wxLogError(_("Invalid display mode specification '%s'."), modeDesc.c_str()); + + return FALSE; + } + + if ( !SetDisplayMode(wxDisplayModeInfo(w, h, bpp)) ) + return FALSE; + } +#endif // __WXMGL__ + return TRUE; } @@ -294,7 +325,7 @@ void wxTrap() { #if defined(__WXMSW__) && !defined(__WXMICROWIN__) DebugBreak(); -#elif defined(__WXMAC__) +#elif defined(__WXMAC__) && !defined(__DARWIN__) #if __powerc Debugger(); #else