diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2018-03-22 12:54:35 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2018-03-29 10:01:41 +0000 |
commit | bff59f87ba11cac1dfa710f021522372de7a776f (patch) | |
tree | 9fa99636bf623d631abd5f9a0fef073c150b7fe0 /src/gui/kernel/qplatformwindow.cpp | |
parent | db7c644cd634cce3b309fb63978f466456e0f559 (diff) |
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 <simon.hausmann@qt.io>
Diffstat (limited to 'src/gui/kernel/qplatformwindow.cpp')
-rw-r--r-- | src/gui/kernel/qplatformwindow.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
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,12 +743,28 @@ 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. */ QSize QPlatformWindow::windowMinimumSize() const |