X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e933b5bc365e0907a4f0fd15b4c49e4c96c2b59f..d71a2d786386b75b184b7a4947e153d51b1af091:/src/motif/evtloop.cpp diff --git a/src/motif/evtloop.cpp b/src/motif/evtloop.cpp index 205496ca05..a3e4b54dea 100644 --- a/src/motif/evtloop.cpp +++ b/src/motif/evtloop.cpp @@ -17,34 +17,39 @@ // headers // ---------------------------------------------------------------------------- +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + #ifdef __VMS #define XtParent XTPARENT #define XtDisplay XTDISPLAY #endif -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - #ifndef WX_PRECOMP + #include "wx/event.h" + #include "wx/app.h" + #include "wx/window.h" + #include "wx/module.h" #endif //WX_PRECOMP #include "wx/evtloop.h" -#include "wx/event.h" -#include "wx/app.h" -#include "wx/window.h" #ifdef __VMS__ -#pragma message disable nosimpint + #pragma message disable nosimpint #endif #include #include #ifdef __VMS__ -#pragma message enable nosimpint + #pragma message enable nosimpint #endif #include "wx/unix/private.h" #include "wx/motif/private.h" +#ifdef HAVE_SYS_SELECT_H +# include +#endif + static bool CheckForKeyUp(XEvent* event); static bool CheckForKeyDown(XEvent* event); static bool CheckForAccelerator(XEvent* event); @@ -96,20 +101,17 @@ bool wxEventLoopImpl::SendIdleMessage() // wxEventLoop running and exiting // ---------------------------------------------------------------------------- -wxEventLoop *wxEventLoopBase::ms_activeLoop = NULL; - -wxEventLoop::~wxEventLoop() +wxGUIEventLoop::~wxGUIEventLoop() { wxASSERT_MSG( !m_impl, _T("should have been deleted in Run()") ); } -int wxEventLoop::Run() +int wxGUIEventLoop::Run() { // event loops are not recursive, you need to create another loop! wxCHECK_MSG( !IsRunning(), -1, _T("can't reenter a message loop") ); - wxEventLoop *oldLoop = ms_activeLoop; - ms_activeLoop = this; + wxEventLoopActivator activate(this); m_impl = new wxEventLoopImpl; m_impl->SetKeepGoing( true ); @@ -120,16 +122,16 @@ int wxEventLoop::Run() break; } + OnExit(); + int exitcode = m_impl->GetExitCode(); delete m_impl; m_impl = NULL; - ms_activeLoop = oldLoop; - return exitcode; } -void wxEventLoop::Exit(int rc) +void wxGUIEventLoop::Exit(int rc) { wxCHECK_RET( IsRunning(), _T("can't call Exit() if not running") ); @@ -143,12 +145,12 @@ void wxEventLoop::Exit(int rc) // wxEventLoop message processing dispatching // ---------------------------------------------------------------------------- -bool wxEventLoop::Pending() const +bool wxGUIEventLoop::Pending() const { return XtAppPending( (XtAppContext)wxTheApp->GetAppContext() ) != 0; } -bool wxEventLoop::Dispatch() +bool wxGUIEventLoop::Dispatch() { XEvent event; XtAppContext context = (XtAppContext)wxTheApp->GetAppContext(); @@ -336,7 +338,7 @@ bool CheckForKeyUp(XEvent* event) // executes one main loop iteration (declared in include/wx/motif/private.h) // ---------------------------------------------------------------------------- -bool wxDoEventLoopIteration( wxEventLoop& evtLoop ) +bool wxDoEventLoopIteration( wxGUIEventLoop& evtLoop ) { bool moreRequested, pendingEvents; @@ -378,8 +380,6 @@ bool wxDoEventLoopIteration( wxEventLoop& evtLoop ) // also wxEventLoop::Exit is implemented that way, so that exiting an // event loop won't require an event being in the queue -#include "wx/module.h" - #include #include #include @@ -482,4 +482,3 @@ bool wxAddIdleCallback() return true; } -