X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d76048f514b0de4307c2490f8806bf41033bc81a..f7035880664b0989ba37df99956b556c322d50a7:/src/mgl/app.cpp?ds=sidebyside diff --git a/src/mgl/app.cpp b/src/mgl/app.cpp index bcb909fcc8..994448650d 100644 --- a/src/mgl/app.cpp +++ b/src/mgl/app.cpp @@ -35,6 +35,7 @@ #include "wx/univ/theme.h" #include "wx/univ/renderer.h" #include "wx/univ/colschem.h" +#include "wx/sysopt.h" #include "wx/mgl/private.h" //----------------------------------------------------------------------------- @@ -156,7 +157,7 @@ static bool wxCreateMGL_WM(const wxDisplayModeInfo& displayMode) int refresh = MGL_DEFAULT_REFRESH; #if wxUSE_SYSTEM_OPTIONS - if ( wxSystemOptions::HasOption(wxT("mgl.screen-refresh") ) + if ( wxSystemOptions::HasOption(wxT("mgl.screen-refresh")) ) refresh = wxSystemOptions::GetOptionInt(wxT("mgl.screen-refresh")); #endif @@ -219,6 +220,20 @@ wxApp::~wxApp() { } +wxDisplayModeInfo wxGetDefaultDisplayMode() +{ + wxString mode; + unsigned w, h, bpp; + + if ( !wxGetEnv(wxT("WXMODE"), &mode) || + (wxSscanf(mode.c_str(), _T("%ux%u-%u"), &w, &h, &bpp) != 3) ) + { + w = 640, h = 480, bpp = 16; + } + + return wxDisplayModeInfo(w, h, bpp); +} + bool wxApp::SetDisplayMode(const wxDisplayModeInfo& mode) { if ( !mode.IsOk() ) @@ -396,8 +411,6 @@ bool wxApp::Initialize() wxClassInfo::InitializeClasses(); - wxSystemSettings::Init(); - #if wxUSE_INTL wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding()); #endif @@ -460,13 +473,10 @@ void wxApp::CleanUp() wxDeleteStockObjects(); wxDeleteStockLists(); - // Can't do this in wxModule, because fonts are needed by stock lists - delete wxTheFontsManager; - wxTheFontsManager = (wxFontsManager*) NULL; - delete wxTheApp; wxTheApp = (wxApp*) NULL; + // GL: I'm annoyed ... I don't know where to put this and I don't want to // create a module for that as it's part of the core. #if wxUSE_THREADS @@ -474,11 +484,15 @@ void wxApp::CleanUp() delete wxPendingEventsLocker; #endif - wxSystemSettings::Done(); + wxClassInfo::CleanUpClasses(); - delete[] wxBuffer; + // Can't do this in wxModule, because fonts are needed by stock lists + // (do it after deleting wxTheApp and cleaning modules up, since somebody + // may be deleting fonts that lately) + delete wxTheFontsManager; + wxTheFontsManager = (wxFontsManager*) NULL; - wxClassInfo::CleanUpClasses(); + delete[] wxBuffer; // check for memory leaks #if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT