second part of #10320: move wxApp event handling functions to wxEventLoopBase (in particular move Yield() functions); add backward compatible redirections to wxApp; update docs; remove global lists wxPendingEvents and wxPendingEventsLocker
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58911 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -117,3 +117,52 @@ bool wxGUIEventLoop::Dispatch()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxYield
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool wxGUIEventLoop::YieldFor(long eventsToProcess)
|
||||
{
|
||||
#if wxUSE_THREADS
|
||||
if ( !wxThread::IsMain() )
|
||||
{
|
||||
// can't call gtk_main_iteration() from other threads like this
|
||||
return true;
|
||||
}
|
||||
#endif // wxUSE_THREADS
|
||||
|
||||
m_isInsideYield = true;
|
||||
m_eventsToProcessInsideYield = eventsToProcess;
|
||||
|
||||
// We need to remove idle callbacks or the loop will
|
||||
// never finish.
|
||||
wxTheApp->RemoveIdleTag();
|
||||
|
||||
#if wxUSE_LOG
|
||||
// disable log flushing from here because a call to wxYield() shouldn't
|
||||
// normally result in message boxes popping up &c
|
||||
wxLog::Suspend();
|
||||
#endif
|
||||
|
||||
// TODO: implement event filtering using the eventsToProcess mask
|
||||
while (gtk_events_pending())
|
||||
gtk_main_iteration();
|
||||
|
||||
// It's necessary to call ProcessIdle() to update the frames sizes which
|
||||
// might have been changed (it also will update other things set from
|
||||
// OnUpdateUI() which is a nice (and desired) side effect). But we
|
||||
// call ProcessIdle() only once since this is not meant for longish
|
||||
// background jobs (controlled by wxIdleEvent::RequestMore() and the
|
||||
// return value of Processidle().
|
||||
ProcessIdle();
|
||||
|
||||
#if wxUSE_LOG
|
||||
// let the logs be flashed again
|
||||
wxLog::Resume();
|
||||
#endif
|
||||
|
||||
m_isInsideYield = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user