diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2014-06-26 15:15:56 +0200 |
---|---|---|
committer | Jonathan Liu <net147@gmail.com> | 2014-10-22 05:53:15 +0200 |
commit | dafd1ffa2c6fb8823b8e582d7cc75a050e14a80e (patch) | |
tree | edb180daf78417006b420842259a0b50d9d8430b | |
parent | 42bdbed7cedc5d77e999143c44c3e095b7cd4ebd (diff) |
QPA: Flush window system events with flags.
Add a QEventLoop::ProcessEventsFlags argument to
flushWindowSystemEvents(). This gives the platform
plugins more control over which events to flush.
Task-number: QTBUG-39842
Change-Id: Id9c01948b22e297b22503d38ec4e726f9f880fd5
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Reviewed-by: Jonathan Liu <net147@gmail.com>
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 5 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface.cpp | 10 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface.h | 4 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface_p.h | 4 |
4 files changed, 13 insertions, 10 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 5233d76d7b..59bcd37251 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1628,8 +1628,9 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv QWindowSystemInterfacePrivate::ApplicationStateChangedEvent * changeEvent = static_cast<QWindowSystemInterfacePrivate::ApplicationStateChangedEvent *>(e); QGuiApplicationPrivate::setApplicationState(changeEvent->newState, changeEvent->forcePropagate); } break; - case QWindowSystemInterfacePrivate::FlushEvents: - QWindowSystemInterface::deferredFlushWindowSystemEvents(); + case QWindowSystemInterfacePrivate::FlushEvents: { + QWindowSystemInterfacePrivate::FlushEventsEvent *flushEventsEvent = static_cast<QWindowSystemInterfacePrivate::FlushEventsEvent *>(e); + QWindowSystemInterface::deferredFlushWindowSystemEvents(flushEventsEvent->flags); } break; case QWindowSystemInterfacePrivate::Close: QGuiApplicationPrivate::processCloseEvent( diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index bd95a8614f..722a695481 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -526,16 +526,16 @@ void QWindowSystemInterface::handleExposeEvent(QWindow *tlw, const QRegion ®i QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } -void QWindowSystemInterface::deferredFlushWindowSystemEvents() +void QWindowSystemInterface::deferredFlushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags) { Q_ASSERT(QThread::currentThread() == QGuiApplication::instance()->thread()); QMutexLocker locker(&QWindowSystemInterfacePrivate::flushEventMutex); - flushWindowSystemEvents(); + flushWindowSystemEvents(flags); QWindowSystemInterfacePrivate::eventsFlushed.wakeOne(); } -void QWindowSystemInterface::flushWindowSystemEvents() +void QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags) { const int count = QWindowSystemInterfacePrivate::windowSystemEventQueue.count(); if (!count) @@ -549,11 +549,11 @@ void QWindowSystemInterface::flushWindowSystemEvents() } if (QThread::currentThread() != QGuiApplication::instance()->thread()) { QMutexLocker locker(&QWindowSystemInterfacePrivate::flushEventMutex); - QWindowSystemInterfacePrivate::FlushEventsEvent *e = new QWindowSystemInterfacePrivate::FlushEventsEvent(); + QWindowSystemInterfacePrivate::FlushEventsEvent *e = new QWindowSystemInterfacePrivate::FlushEventsEvent(flags); QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); QWindowSystemInterfacePrivate::eventsFlushed.wait(&QWindowSystemInterfacePrivate::flushEventMutex); } else { - sendWindowSystemEvents(QEventLoop::AllEvents); + sendWindowSystemEvents(flags); } } diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index 9784757d3a..30c236b51f 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -208,8 +208,8 @@ public: // For event dispatcher implementations static bool sendWindowSystemEvents(QEventLoop::ProcessEventsFlags flags); static void setSynchronousWindowsSystemEvents(bool enable); - static void flushWindowSystemEvents(); - static void deferredFlushWindowSystemEvents(); + static void flushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents); + static void deferredFlushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags); static int windowSystemEventsQueued(); }; diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index f48c75a027..c3f41da835 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -178,9 +178,11 @@ public: class FlushEventsEvent : public WindowSystemEvent { public: - FlushEventsEvent() + FlushEventsEvent(QEventLoop::ProcessEventsFlags f = QEventLoop::AllEvents) : WindowSystemEvent(FlushEvents) + , flags(f) { } + QEventLoop::ProcessEventsFlags flags; }; class UserEvent : public WindowSystemEvent { |