From 4bae7158d379acb15a4eae02a4fc3d3e6103a7f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 16 Sep 2013 12:52:46 +0200 Subject: 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 --- src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp') 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 +#include #include #include @@ -83,6 +84,7 @@ bool QWindowsGuiEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags fl void QWindowsGuiEventDispatcher::sendPostedEvents() { + QCoreApplication::sendPostedEvents(); QWindowSystemInterface::sendWindowSystemEvents(m_flags); } -- cgit v1.2.3