X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/eb6fa4b4257897e4e9655b05e4105e8b47f67476..172df1f0351019adaada76e16847b3ca6c2421eb:/src/motif/evtloop.cpp?ds=sidebyside diff --git a/src/motif/evtloop.cpp b/src/motif/evtloop.cpp index 41c575d343..bcb13876da 100644 --- a/src/motif/evtloop.cpp +++ b/src/motif/evtloop.cpp @@ -17,7 +17,7 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "evtloop.h" #endif @@ -83,9 +83,7 @@ private: static bool SendIdleMessage() { - wxIdleEvent event; - - return wxTheApp->ProcessEvent(event) && event.MoreRequested(); + return wxTheApp->ProcessIdle(); } bool wxEventLoopImpl::SendIdleMessage() @@ -101,18 +99,13 @@ bool wxEventLoopImpl::SendIdleMessage() // wxEventLoop running and exiting // ---------------------------------------------------------------------------- -wxEventLoop *wxEventLoop::ms_activeLoop = NULL; +wxEventLoop *wxEventLoopBase::ms_activeLoop = NULL; wxEventLoop::~wxEventLoop() { wxASSERT_MSG( !m_impl, _T("should have been deleted in Run()") ); } -bool wxEventLoop::IsRunning() const -{ - return m_impl != NULL; -} - int wxEventLoop::Run() { // event loops are not recursive, you need to create another loop! @@ -362,7 +355,7 @@ bool wxDoEventLoopIteration( wxEventLoop& evtLoop ) // leave the main loop to give other threads a chance to // perform their GUI work wxMutexGuiLeave(); - wxUsleep(20); + wxMilliSleep(20); wxMutexGuiEnter(); } #endif @@ -402,9 +395,11 @@ public: virtual bool OnInit() { + // Must be done before modules are initialized +#if 0 if( pipe(idleFds) != 0 ) return false; - +#endif return true; } @@ -414,7 +409,7 @@ public: close( idleFds[1] ); } private: - DECLARE_DYNAMIC_CLASS(wxIdlePipeModule); + DECLARE_DYNAMIC_CLASS(wxIdlePipeModule) }; IMPLEMENT_DYNAMIC_CLASS(wxIdlePipeModule, wxModule); @@ -463,13 +458,23 @@ static void wxBreakDispatch() write( idleFds[1], &dummy, 1 ); } -void wxWakeUpIdle() +void wxApp::WakeUpIdle() { ::wxBreakDispatch(); } +bool wxInitIdleFds() +{ + if( pipe(idleFds) != 0 ) + return false; + return true; +} + bool wxAddIdleCallback() { + if (!wxInitIdleFds()) + return false; + // install input handler for wxWakeUpIdle inputId = XtAppAddInput( (XtAppContext) wxTheApp->GetAppContext(), idleFds[0],