Commit 383a7577 authored by Clinton Stimpson's avatar Clinton Stimpson

BUG: change wait function to wait on window events for an interval

      instead of sleeping for an interval.
parent 8ab15d39
......@@ -32,13 +32,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "pqEventDispatcher.h"
#ifdef Q_OS_WIN
#include <windows.h> // for Sleep
#endif
#ifdef Q_OS_UNIX
#include <time.h>
#endif
#include "pqEventPlayer.h"
#include "pqEventSource.h"
......@@ -47,6 +40,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QTime>
#include <QTimer>
#include <QApplication>
#include <QEventLoop>
////////////////////////////////////////////////////////////////////////////
// pqEventDispatcher::pqImplementation
......@@ -205,20 +199,9 @@ void pqEventDispatcher::stopPlayback()
void pqEventDispatcher::processEventsAndWait(int ms)
{
pqEventDispatcher::pqImplementation::WaitTime = ms <= 0 ? 1 : ms;
QTime timer;
timer.start();
do {
QCoreApplication::processEvents(QEventLoop::AllEvents, ms);
#ifdef Q_OS_WIN
Sleep(uint(10));
#else
struct timespec ts = { 10 / 1000, (10 % 1000) * 1000 * 1000 };
nanosleep(&ts, NULL);
#endif
} while (timer.elapsed() < ms);
QEventLoop loop;
QTimer::singleShot(ms, &loop, SLOT(quit()));
loop.exec();
pqEventDispatcher::pqImplementation::WaitTime = 0;
}
......@@ -91,7 +91,7 @@ int pqThreadedEventSource::getNextEvent(
{
// wait for the other thread to post an event, while
// we keep the GUI alive.
pqEventDispatcher::processEventsAndWait(1000);
pqEventDispatcher::processEventsAndWait(100);
}
object = this->Internal->CurrentObject;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment