diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2013-09-16 12:52:46 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-16 15:22:40 +0200 |
commit | 4bae7158d379acb15a4eae02a4fc3d3e6103a7f9 (patch) | |
tree | 5329c28c59f104015d1b4b465a1634c59267cd3f /src/platformsupport | |
parent | 4c19055cb1b077cf161d9cd5c031d711f42a3f25 (diff) |
Don't send posted events from QWindowSystemInterface::sendWindowSystemEvents
The responsibility of sendWindowSystemEvents() is to process events from
the window system. Historially that logic was part of the QPA/QWS event
dispatcher, which naturally also sent posted events. Through refactoring,
the code at some point ended up in in the QWindowSystemInterface class,
still with the posting of events in place.
This resulted in QPA event dispatchers adopting a pattern of just calling
sendWindowSystemEvents(), as that would cover both posted and window system
events. Other event dispatchers would call sendWindowSystemEvents(), and
then use a base-class implementation from QtCore for processing events,
resulting in two calls to QCoreApplication::sendPostedEvents() per
iteration of processEvents(). This breaks the contract that processEvents
will only process posted events that has been queued up until then.
We fix this entanglement by removing the sendPostedEvents() call from
QWindowSystemInterface::sendWindowSystemEvents() and move it to the
respective event dispatchers. For some EDs it means an explicit call
to sendPostedEvents, while others were already doing sendPostedEvents
though a separate source (GLib), or using a base-class (UNIX/BB), and
did not need an extra call.
We still keep the ordering of the original sendWindowSystemEvents()
function of first sending posted events, and then processing any
window system events.
Task-number: QTBUG-33485
Change-Id: I8b069e76cea1f37875e72a034c11d09bf3fe166a
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Diffstat (limited to 'src/platformsupport')
-rw-r--r-- | src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm | 4 | ||||
-rw-r--r-- | src/platformsupport/eventdispatchers/qunixeventdispatcher.cpp | 9 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm b/src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm index 6442df715a..ed86a33782 100644 --- a/src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm +++ b/src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm @@ -388,6 +388,10 @@ void QEventDispatcherCoreFoundation::processPostedEvents() m_processEvents.processedPostedEvents = true; + qEventDispatcherDebug() << "Sending posted events for " << m_processEvents.flags; qIndent(); + QCoreApplication::sendPostedEvents(); + qUnIndent(); + qEventDispatcherDebug() << "Sending window system events for " << m_processEvents.flags; qIndent(); QWindowSystemInterface::sendWindowSystemEvents(m_processEvents.flags); qUnIndent(); diff --git a/src/platformsupport/eventdispatchers/qunixeventdispatcher.cpp b/src/platformsupport/eventdispatchers/qunixeventdispatcher.cpp index 20ef91c7d8..5e07832c07 100644 --- a/src/platformsupport/eventdispatchers/qunixeventdispatcher.cpp +++ b/src/platformsupport/eventdispatchers/qunixeventdispatcher.cpp @@ -67,13 +67,8 @@ QUnixEventDispatcherQPA::~QUnixEventDispatcherQPA() bool QUnixEventDispatcherQPA::processEvents(QEventLoop::ProcessEventsFlags flags) { - const bool didSendEvents = QWindowSystemInterface::sendWindowSystemEvents(flags); - - if (QEventDispatcherUNIX::processEvents(flags)) { - return true; - } - - return didSendEvents; + const bool didSendEvents = QEventDispatcherUNIX::processEvents(flags); + return QWindowSystemInterface::sendWindowSystemEvents(flags) || didSendEvents; } bool QUnixEventDispatcherQPA::hasPendingEvents() |