From bff59f87ba11cac1dfa710f021522372de7a776f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 22 Mar 2018 12:54:35 +0100 Subject: Move delivery of update requests into QPlatformWindow Having deliverUpdateRequest in QWindowPrivate was a bit awkward and asymmetric to the QPlatformWindow::requestUpdate() API. Keeping them together follows the existing pattern of plumbing things through the platform window, and also allows us to move away from platform plugins relying on QWindowPrivate implementation details. Change-Id: Ib131ccdd1c2bdd6ff1c8d95facbc3f6f88a1abcf Reviewed-by: Simon Hausmann --- src/gui/kernel/qplatformwindow.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/gui/kernel/qplatformwindow.cpp') diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index a3046a9b44..bc1aeb8217 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -724,7 +724,7 @@ QRect QPlatformWindow::initialGeometry(const QWindow *w, QPlatformWindow subclasses can re-implement this function to provide display refresh synchronized updates. The event - should be delivered using QWindowPrivate::deliverUpdateRequest() + should be delivered using QPlatformWindow::deliverUpdateRequest() to not get out of sync with the the internal state of QWindow. The default implementation posts an UpdateRequest event to the @@ -743,11 +743,27 @@ void QPlatformWindow::requestUpdate() } QWindow *w = window(); - QWindowPrivate *wp = (QWindowPrivate *) QObjectPrivate::get(w); + QWindowPrivate *wp = qt_window_private(w); Q_ASSERT(wp->updateTimer == 0); wp->updateTimer = w->startTimer(timeout, Qt::PreciseTimer); } +/*! + Delivers an QEvent::UpdateRequest event to the window. + + QPlatformWindow subclasses can re-implement this function to + provide e.g. logging or tracing of the delivery, but should + always call the base class function. +*/ +void QPlatformWindow::deliverUpdateRequest() +{ + QWindow *w = window(); + QWindowPrivate *wp = qt_window_private(w); + wp->updateRequestPending = false; + QEvent request(QEvent::UpdateRequest); + QCoreApplication::sendEvent(w, &request); +} + /*! Returns the QWindow minimum size. */ -- cgit v1.2.3