Fixed multi-touch event loop problems by selectively processing just the touch events.

This commit is contained in:
Eric Johnston 2013-07-08 16:31:28 -07:00
parent 7de2281226
commit c298f78ae9

View file

@ -955,17 +955,16 @@ void Application::idle() {
// Only run simulation code if more than IDLE_SIMULATE_MSECS have passed since last time we ran // Only run simulation code if more than IDLE_SIMULATE_MSECS have passed since last time we ran
if (diffclock(&_lastTimeIdle, &check) > IDLE_SIMULATE_MSECS) { if (diffclock(&_lastTimeIdle, &check) > IDLE_SIMULATE_MSECS) {
// We call processEvents() here because the idle timer takes priority over
// event handling in Qt, so when the framerate gets low events will pile up
// unless we handle them here.
// NOTE - this is commented out for now - causing event processing issues reported by Philip and Ryan // If we're using multi-touch look, immediately process any
// birarda - July 3rd // touch events, and no other events.
// Added some safety catches which will enable us to test this. // This is necessary because id the idle() call takes longer than the
// ej - July 3rd // interval between idle() calls, the event loop never gets to run,
// and touch events get delayed.
if (_touchLook->isChecked()) { if (_touchLook->isChecked()) {
int maxTimeMS = 1; sendPostedEvents(NULL, QEvent::TouchBegin);
processEvents(QEventLoop::ExcludeSocketNotifiers, maxTimeMS); sendPostedEvents(NULL, QEvent::TouchUpdate);
sendPostedEvents(NULL, QEvent::TouchEnd);
} }
update(1.0f / _fps); update(1.0f / _fps);