From 3ea100e595e1483c7e1ea7b8fd8e8b77e9530fe3 Mon Sep 17 00:00:00 2001 From: Eric Johnston Date: Wed, 3 Jul 2013 15:33:18 -0700 Subject: [PATCH 1/2] Added safety checks to processEvents(), which was causing problems. Also narrowed the scope of the events processed. It can now be disabled in the interface by un-checking touch-look, which most people don't use yet. Also, the event processing time should be limited to 1 ms. --- interface/src/Application.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 088dd03e03..aa7019a0b0 100755 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -950,8 +950,12 @@ void Application::idle() { // NOTE - this is commented out for now - causing event processing issues reported by Philip and Ryan // birarda - July 3rd - - // processEvents(); + // Added some safety catches which will enable us to test this. + // ej - July 3rd + if (_touchLook->isChecked()) { + int maxTimeMS = 1; + processEvents(QEventLoop::ExcludeSocketNotifiers, maxTimeMS); + } update(1.0f / _fps); From c298f78ae97659cb33b9dbd874d4e6f816c1d931 Mon Sep 17 00:00:00 2001 From: Eric Johnston Date: Mon, 8 Jul 2013 16:31:28 -0700 Subject: [PATCH 2/2] Fixed multi-touch event loop problems by selectively processing just the touch events. --- interface/src/Application.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 668ed4d7bc..20cf2d70ce 100755 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -955,17 +955,16 @@ void Application::idle() { // Only run simulation code if more than IDLE_SIMULATE_MSECS have passed since last time we ran 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 - // birarda - July 3rd - // Added some safety catches which will enable us to test this. - // ej - July 3rd + // If we're using multi-touch look, immediately process any + // touch events, and no other events. + // This is necessary because id the idle() call takes longer than the + // interval between idle() calls, the event loop never gets to run, + // and touch events get delayed. if (_touchLook->isChecked()) { - int maxTimeMS = 1; - processEvents(QEventLoop::ExcludeSocketNotifiers, maxTimeMS); + sendPostedEvents(NULL, QEvent::TouchBegin); + sendPostedEvents(NULL, QEvent::TouchUpdate); + sendPostedEvents(NULL, QEvent::TouchEnd); } update(1.0f / _fps);