summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorten Sorvig <morten.sorvig@nokia.com>2010-03-16 16:39:00 +0100
committerMorten Sorvig <morten.sorvig@nokia.com>2010-03-16 16:39:28 +0100
commit21a6636135174831d781255dbbcfe64456a21be6 (patch)
tree7d6a83d999ab2b1c681bff2fa2b61b90094ed178
parent49fb853c0c194bb772e5fd51604d5571bc016959 (diff)
Further tweaking of timer event delivery.
-rw-r--r--src/gui/kernel/qeventdispatcher_pepper.cpp33
1 files changed, 20 insertions, 13 deletions
diff --git a/src/gui/kernel/qeventdispatcher_pepper.cpp b/src/gui/kernel/qeventdispatcher_pepper.cpp
index ea7fbc3dc8..e0f4dce068 100644
--- a/src/gui/kernel/qeventdispatcher_pepper.cpp
+++ b/src/gui/kernel/qeventdispatcher_pepper.cpp
@@ -121,6 +121,17 @@ bool QEventDispatcherPepper::processEvents(QEventLoop::ProcessEventsFlags flags)
QMutexLocker lock(&mutex);
forever {
+ // Possibly send timer events. The plugin thread sets
+ // this when it recieves a timer callback. Do this
+ // (once) before processing input events to ensure timely
+ // timer delivery.
+ if (callActivateTimers) {
+ callActivateTimers = false;
+ lock.unlock();
+ activateTimers();
+ lock.relock();
+ }
+
// Process all events in the queue. Release the lock while
// processing - the plugin thread can add more events.
while (eventQueue.isEmpty() == false) {
@@ -129,28 +140,24 @@ bool QEventDispatcherPepper::processEvents(QEventLoop::ProcessEventsFlags flags)
lock.unlock();
++eventCount;
processPepperEvent(&event);
- lock.relock();
+
+ // Possibly send more timer events.
+ if (callActivateTimers) {
+ callActivateTimers = false;
+ activateTimers();
+ }
+
+ lock.relock();
}
- lock.unlock();
-
- // Possibly send timer events. The plugin thread sets
- // this when it recieves a timer callback.
- if (callActivateTimers) {
- activateTimers();
- callActivateTimers = false;
- }
-
if (!(flags & QEventLoop::WaitForMoreEvents)) {
break;
}
- lock.relock();
-
// Check the queue again while holding the lock to
// prevent sleeping after the plugin thread has added
// an event and decided that the qt thread is active.
- if (eventQueue.isEmpty() == false)
+ if (callActivateTimers || eventQueue.isEmpty() == false)
continue;
// Wait until the plugin thread adds more events