- if (!wxTheApp)
- return false;
-
-#ifdef __WXDEBUG__
- // don't generate the idle events while the assert modal dialog is shown,
- // this completely confuses the apps which don't expect to be reentered
- // from some safely-looking functions
- if ( wxTheApp->IsInAssert() )
- return false;
-#endif // __WXDEBUG__
-
- // When getting called from GDK's time-out handler
- // we are no longer within GDK's grab on the GUI
- // thread so we must lock it here ourselves.
- gdk_threads_enter();
-
- // Indicate that we are now in idle mode and event handlers
- // will have to reinstall the idle handler again.
- {
-#if wxUSE_THREADS
- wxMutexLocker lock(gs_idleTagsMutex);
-#endif
- g_isIdle = true;
- wxTheApp->m_idleTag = 0;
- }
-
- bool moreIdles;
-
- // Send idle event to all who request them as long as
- // no events have popped up in the event queue.
- while ( (moreIdles = wxTheApp->ProcessIdle()) && gtk_events_pending() == 0)
- ;
-
- // Release lock again
- gdk_threads_leave();
-
- // Return FALSE if no more idle events are to be sent
- return moreIdles;