Don't generate idle events when the event loop is not running
This commit is contained in:
@@ -24,6 +24,8 @@ public:
|
||||
virtual void WakeUp() wxOVERRIDE;
|
||||
virtual void DoYieldFor(long eventsToProcess) wxOVERRIDE;
|
||||
|
||||
void ScheduleIdleCheck();
|
||||
|
||||
#if wxUSE_EVENTLOOP_SOURCE
|
||||
virtual wxEventLoopSource *AddSourceForFD(int fd, wxEventLoopSourceHandler *handler, int flags);
|
||||
#endif // wxUSE_EVENTLOOP_SOURCE
|
||||
|
@@ -40,14 +40,13 @@ wxQtIdleTimer::wxQtIdleTimer( wxQtEventLoopBase *eventLoop )
|
||||
|
||||
connect( this, &QTimer::timeout, this, &wxQtIdleTimer::idle );
|
||||
setSingleShot( true );
|
||||
start( 0 );
|
||||
}
|
||||
|
||||
bool wxQtIdleTimer::eventFilter( QObject *WXUNUSED( watched ), QEvent *WXUNUSED( event ) )
|
||||
{
|
||||
// Called for each Qt event, start with timeout 0 (run as soon as idle)
|
||||
if ( !isActive() )
|
||||
start( 0 );
|
||||
m_eventLoop->ScheduleIdleCheck();
|
||||
|
||||
return false; // Continue handling the event
|
||||
}
|
||||
@@ -60,7 +59,7 @@ void wxQtIdleTimer::idle()
|
||||
|
||||
// Send idle event
|
||||
if ( m_eventLoop->ProcessIdle() )
|
||||
start( 0 );
|
||||
m_eventLoop->ScheduleIdleCheck();
|
||||
}
|
||||
|
||||
wxQtEventLoopBase::wxQtEventLoopBase()
|
||||
@@ -147,6 +146,12 @@ void wxQtEventLoopBase::DoYieldFor(long eventsToProcess)
|
||||
wxEventLoopBase::DoYieldFor(eventsToProcess);
|
||||
}
|
||||
|
||||
void wxQtEventLoopBase::ScheduleIdleCheck()
|
||||
{
|
||||
if ( IsInsideRun() )
|
||||
m_qtIdleTimer->start(0);
|
||||
}
|
||||
|
||||
#if wxUSE_EVENTLOOP_SOURCE
|
||||
|
||||
template <void (wxEventLoopSourceHandler::*function)()>
|
||||
|
Reference in New Issue
Block a user