X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d9698bd4acdee91faaca22c4246842ac9456f876..5aac6f3f9563d5a56470982cc11c35c81f555671:/src/msw/app.cpp diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 00f768bf6b..50df7cdeff 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -117,13 +117,12 @@ extern void wxSetKeyboardHook(bool doIt); #endif -namespace -{ - +// because of mingw32 4.3 bug this struct can't be inside the namespace below: +// see http://article.gmane.org/gmane.comp.lib.wxwidgets.devel/110282 struct ClassRegInfo { // the base name of the class: this is used to construct the unique name in - // RegisterClassWithUniqueNames() + // wxApp::GetRegisteredClassName() wxString basename; // the name of the registered class with and without CS_[HV]REDRAW styles @@ -131,6 +130,9 @@ struct ClassRegInfo regnameNR; }; +namespace +{ + wxVector gs_regClassesInfo; } // anonymous namespace @@ -394,7 +396,7 @@ private: GetConsoleCommandHistory_t m_pfnGetConsoleCommandHistory; GetConsoleCommandHistoryLength_t m_pfnGetConsoleCommandHistoryLength; - DECLARE_NO_COPY_CLASS(wxConsoleStderr) + wxDECLARE_NO_COPY_CLASS(wxConsoleStderr); }; bool wxConsoleStderr::DoInit() @@ -654,7 +656,7 @@ const wxChar *wxApp::GetRegisteredClassName(const wxChar *name, for ( size_t n = 0; n < count; n++ ) { if ( gs_regClassesInfo[n].basename == name ) - return gs_regClassesInfo[n].regname; + return gs_regClassesInfo[n].regname.c_str(); } // we need to register this class @@ -696,7 +698,7 @@ const wxChar *wxApp::GetRegisteredClassName(const wxChar *name, { wxLogLastError(wxString::Format(wxT("RegisterClass(%s)"), regClass.regname)); - ::UnregisterClass(regClass.regname, wxhInstance); + ::UnregisterClass(regClass.regname.c_str(), wxhInstance); return NULL; } @@ -728,13 +730,13 @@ void wxApp::UnregisterWindowClasses() for ( size_t n = 0; n < count; n++ ) { const ClassRegInfo& regClass = gs_regClassesInfo[n]; - if ( !::UnregisterClass(regClass.regname, wxhInstance) ) + if ( !::UnregisterClass(regClass.regname.c_str(), wxhInstance) ) { wxLogLastError(wxString::Format(wxT("UnregisterClass(%s)"), regClass.regname)); } - if ( !::UnregisterClass(regClass.regnameNR, wxhInstance) ) + if ( !::UnregisterClass(regClass.regnameNR.c_str(), wxhInstance) ) { wxLogLastError(wxString::Format(wxT("UnregisterClass(%s)"), regClass.regnameNR)); @@ -917,10 +919,7 @@ int wxApp::GetComCtl32Version() // depending on the OS version and the presence of the manifest, it can // be either v5 or v6 and instead of trying to guess it just get the // handle of the already loaded version - wxDynamicLibrary dllComCtl32(_T("comctl32.dll"), - wxDL_VERBATIM | - wxDL_QUIET | - wxDL_GET_LOADED); + wxLoadedDLL dllComCtl32(_T("comctl32.dll")); if ( !dllComCtl32.IsLoaded() ) { s_verComCtl32 = 0; @@ -958,9 +957,6 @@ int wxApp::GetComCtl32Version() } } } - - // we shouldn't unload it here as we didn't really load it above - dllComCtl32.Detach(); } return s_verComCtl32; @@ -1015,61 +1011,6 @@ int wxApp::GetShell32Version() #endif // !__WXWINCE__ -// ---------------------------------------------------------------------------- -// Yield to incoming messages -// ---------------------------------------------------------------------------- - -bool wxApp::Yield(bool onlyIfNeeded) -{ - // MT-FIXME - static bool s_inYield = false; - - if ( s_inYield ) - { - if ( !onlyIfNeeded ) - { - wxFAIL_MSG( wxT("wxYield called recursively" ) ); - } - - return false; - } - - // set the flag and don't forget to reset it before returning - s_inYield = true; - wxON_BLOCK_EXIT_SET(s_inYield, false); - - -#if wxUSE_LOG - // disable log flushing from here because a call to wxYield() shouldn't - // normally result in message boxes popping up &c - wxLog::Suspend(); - - // ensure the logs will be flashed again when we exit - wxON_BLOCK_EXIT0(wxLog::Resume); -#endif // wxUSE_LOG - - - // we don't want to process WM_QUIT from here - it should be processed in - // the main event loop in order to stop it - wxEventLoopGuarantor dummyLoopIfNeeded; - MSG msg; - while ( PeekMessage(&msg, (HWND)0, 0, 0, PM_NOREMOVE) && - msg.message != WM_QUIT ) - { -#if wxUSE_THREADS - wxMutexGuiLeaveOrEnter(); -#endif // wxUSE_THREADS - - if ( !wxTheApp->Dispatch() ) - break; - } - - // if there are pending events, we must process them. - ProcessPendingEvents(); - - return true; -} - #if wxUSE_EXCEPTIONS // ----------------------------------------------------------------------------