Refactor YieldFor() to avoid code duplication among the ports.
Don't repeat the same code in all the ports, move it to the common base class and add a new virtual DoYieldFor() for the really port-specific code. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76061 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -150,29 +150,12 @@ bool wxGUIEventLoop::Dispatch()
|
||||
// wxYield
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool wxGUIEventLoop::YieldFor(long eventsToProcess)
|
||||
void wxGUIEventLoop::DoYieldFor(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();
|
||||
@@ -185,14 +168,7 @@ bool wxGUIEventLoop::YieldFor(long eventsToProcess)
|
||||
// return value of Processidle().
|
||||
ProcessIdle();
|
||||
|
||||
#if wxUSE_LOG
|
||||
// let the logs be flashed again
|
||||
wxLog::Resume();
|
||||
#endif
|
||||
|
||||
m_isInsideYield = false;
|
||||
|
||||
return true;
|
||||
wxEventLoopBase::DoYieldFor(eventsToProcess);
|
||||
}
|
||||
|
||||
class wxGUIEventLoopSourcesManager : public wxEventLoopSourcesManagerBase
|
||||
|
||||
Reference in New Issue
Block a user