X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8cb172b4f12fae80b06d5936108a1bc7f2521674..2fc2d511d0f095ab5de3713cff6042832f886d15:/src/msw/evtloop.cpp diff --git a/src/msw/evtloop.cpp b/src/msw/evtloop.cpp index 73d459dac2..94874f5da1 100644 --- a/src/msw/evtloop.cpp +++ b/src/msw/evtloop.cpp @@ -6,7 +6,7 @@ // Created: 01.06.01 // RCS-ID: $Id$ // Copyright: (c) 2001 Vadim Zeitlin -// License: wxWindows license +// License: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -17,7 +17,7 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "evtloop.h" #endif @@ -29,14 +29,23 @@ #endif #ifndef WX_PRECOMP + #include "wx/window.h" + #include "wx/app.h" #endif //WX_PRECOMP #include "wx/evtloop.h" -#include "wx/window.h" -#include "wx/app.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 // ---------------------------------------------------------------------------- @@ -128,15 +137,15 @@ bool wxEventLoopImpl::PreProcessMessage(MSG *msg) bool wxEventLoopImpl::SendIdleMessage() { - wxIdleEvent event; - - return wxTheApp->ProcessEvent(event) && event.MoreRequested(); + return wxTheApp->ProcessIdle(); } // ============================================================================ // wxEventLoop implementation // ============================================================================ +wxEventLoop *wxEventLoop::ms_activeLoop = NULL; + // ---------------------------------------------------------------------------- // wxEventLoop running and exiting // ---------------------------------------------------------------------------- @@ -157,6 +166,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 ( ;; ) { @@ -182,6 +194,8 @@ int wxEventLoop::Run() delete m_impl; m_impl = NULL; + ms_activeLoop = oldLoop; + return exitcode; } @@ -242,10 +256,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;