X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3808e191421b1337b3c688cf6d75efa43582547a..a111f2b216a90bacb254644d3cae526eddc9f9f1:/src/msw/evtloop.cpp diff --git a/src/msw/evtloop.cpp b/src/msw/evtloop.cpp index 8f45f1e05f..dca66aba58 100644 --- a/src/msw/evtloop.cpp +++ b/src/msw/evtloop.cpp @@ -29,12 +29,23 @@ #endif #ifndef WX_PRECOMP + #include "wx/window.h" + #include "wx/app.h" #endif //WX_PRECOMP #include "wx/evtloop.h" +#include "wx/tooltip.h" #include "wx/msw/private.h" +#if wxUSE_THREADS + // define the array of MSG strutures + WX_DECLARE_OBJARRAY(MSG, wxMsgArray); + // VS: this is a bit dirty - it duplicates same declaration in app.cpp + // (and there's no WX_DEFINE_OBJARRAY for that reason - it is already + // defined in app.cpp). +#endif + // ---------------------------------------------------------------------------- // wxEventLoopImpl // ---------------------------------------------------------------------------- @@ -135,6 +146,8 @@ bool wxEventLoopImpl::SendIdleMessage() // wxEventLoop implementation // ============================================================================ +wxEventLoop *wxEventLoop::ms_activeLoop = NULL; + // ---------------------------------------------------------------------------- // wxEventLoop running and exiting // ---------------------------------------------------------------------------- @@ -155,6 +168,9 @@ int wxEventLoop::Run() wxCHECK_MSG( !IsRunning(), -1, _T("can't reenter a message loop") ); m_impl = new wxEventLoopImpl; + + wxEventLoop *oldLoop = ms_activeLoop; + ms_activeLoop = this; for ( ;; ) { @@ -180,6 +196,8 @@ int wxEventLoop::Run() delete m_impl; m_impl = NULL; + ms_activeLoop = oldLoop; + return exitcode; } @@ -240,10 +258,9 @@ bool wxEventLoop::Dispatch() // leave out WM_COMMAND messages: too dangerous, sometimes // the message will be processed twice - if ( !wxIsWaitingForThread() || - s_currentMsg.message != WM_COMMAND ) + if ( !wxIsWaitingForThread() || msg.message != WM_COMMAND ) { - s_aSavedMessages.Add(s_currentMsg); + s_aSavedMessages.Add(msg); } return TRUE;