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/plugins | |
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/plugins')
4 files changed, 7 insertions, 8 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm index 9a661ffe5a..8dfaacdf13 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm @@ -876,6 +876,7 @@ void QCocoaEventDispatcherPrivate::processPostedEvents() int serial = serialNumber.load(); if (!threadData->canWait || (serial != lastSerial)) { lastSerial = serial; + QCoreApplication::sendPostedEvents(); QWindowSystemInterface::sendWindowSystemEvents(QEventLoop::AllEvents); } } diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp index 5b74ad3b8d..bce52963df 100644 --- a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp +++ b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp @@ -73,9 +73,9 @@ public: bool processEvents(QEventLoop::ProcessEventsFlags flags) { - bool didSendEvents = QWindowSystemInterface::sendWindowSystemEvents(flags); + bool didSendEvents = BaseEventDispatcher::processEvents(flags); - return BaseEventDispatcher::processEvents(flags) || didSendEvents; + return QWindowSystemInterface::sendWindowSystemEvents(flags) || didSendEvents; } bool hasPendingEvents() diff --git a/src/plugins/platforms/qnx/qqnxeventdispatcher_blackberry.cpp b/src/plugins/platforms/qnx/qqnxeventdispatcher_blackberry.cpp index 87ce64da5e..42fd0ed8bf 100644 --- a/src/plugins/platforms/qnx/qqnxeventdispatcher_blackberry.cpp +++ b/src/plugins/platforms/qnx/qqnxeventdispatcher_blackberry.cpp @@ -58,12 +58,8 @@ QQnxEventDispatcherBlackberry::~QQnxEventDispatcherBlackberry() bool QQnxEventDispatcherBlackberry::processEvents(QEventLoop::ProcessEventsFlags flags) { - const bool didSendEvents = QWindowSystemInterface::sendWindowSystemEvents(flags); - - if (QEventDispatcherBlackberry::processEvents(flags)) - return true; - - return didSendEvents; + const bool didSendEvents = QEventDispatcherBlackberry::processEvents(flags); + return QWindowSystemInterface::sendWindowSystemEvents(flags) || didSendEvents; } bool QQnxEventDispatcherBlackberry::hasPendingEvents() diff --git a/src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp b/src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp index 0d7de2da39..6be71999f6 100644 --- a/src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp +++ b/src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp @@ -44,6 +44,7 @@ #include <qpa/qwindowsysteminterface.h> +#include <QtCore/QCoreApplication> #include <QtCore/QStack> #include <QtCore/QDebug> @@ -83,6 +84,7 @@ bool QWindowsGuiEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags fl void QWindowsGuiEventDispatcher::sendPostedEvents() { + QCoreApplication::sendPostedEvents(); QWindowSystemInterface::sendWindowSystemEvents(m_flags); } |