Provide QPlatformWindow::hasPendingUpdateRequest() helper function
So that platform plugins don't need to dive into QWindowPrivate. Change-Id: Ia2d94b3e9236e4a68857e6afe7af063f1b0d0aeb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
parent
8e2a970566
commit
49b4433adf
@ -748,6 +748,16 @@ void QPlatformWindow::requestUpdate()
|
||||
wp->updateTimer = w->startTimer(timeout, Qt::PreciseTimer);
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns true if the window has a pending update request.
|
||||
|
||||
\sa requestUpdate(), deliverUpdateRequest()
|
||||
*/
|
||||
bool QPlatformWindow::hasPendingUpdateRequest() const
|
||||
{
|
||||
return qt_window_private(window())->updateRequestPending;
|
||||
}
|
||||
|
||||
/*!
|
||||
Delivers an QEvent::UpdateRequest event to the window.
|
||||
|
||||
@ -757,6 +767,8 @@ void QPlatformWindow::requestUpdate()
|
||||
*/
|
||||
void QPlatformWindow::deliverUpdateRequest()
|
||||
{
|
||||
Q_ASSERT(hasPendingUpdateRequest());
|
||||
|
||||
QWindow *w = window();
|
||||
QWindowPrivate *wp = qt_window_private(w);
|
||||
wp->updateRequestPending = false;
|
||||
|
@ -144,6 +144,7 @@ public:
|
||||
const QRect &initialGeometry, int defaultWidth, int defaultHeight);
|
||||
|
||||
virtual void requestUpdate();
|
||||
bool hasPendingUpdateRequest() const;
|
||||
virtual void deliverUpdateRequest();
|
||||
|
||||
// Window property accessors. Platform plugins should use these
|
||||
|
@ -115,17 +115,15 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
QWindowPrivate *windowPrivate = qt_window_private(m_platformWindow->window());
|
||||
|
||||
if (m_updateRequested) {
|
||||
Q_ASSERT(windowPrivate->updateRequestPending);
|
||||
Q_ASSERT(m_platformWindow->hasPendingUpdateRequest());
|
||||
m_platformWindow->deliverUpdateRequest();
|
||||
m_updateRequested = false;
|
||||
} else {
|
||||
m_platformWindow->handleExposeEvent(dirtyRegion);
|
||||
}
|
||||
|
||||
if (windowPrivate->updateRequestPending) {
|
||||
if (m_platformWindow->hasPendingUpdateRequest()) {
|
||||
// A call to QWindow::requestUpdate was issued during event delivery above,
|
||||
// but AppKit will reset the needsDisplay state of the view after completing
|
||||
// the current display cycle, so we need to defer the request to redisplay.
|
||||
|
@ -394,18 +394,17 @@ void QIOSScreen::deliverUpdateRequests() const
|
||||
if (platformScreenForWindow(window) != this)
|
||||
continue;
|
||||
|
||||
QWindowPrivate *wp = qt_window_private(window);
|
||||
if (!wp->updateRequestPending)
|
||||
continue;
|
||||
|
||||
QPlatformWindow *platformWindow = window->handle();
|
||||
if (!platformWindow)
|
||||
continue;
|
||||
|
||||
if (!platformWindow->hasPendingUpdateRequest())
|
||||
continue;
|
||||
|
||||
platformWindow->deliverUpdateRequest();
|
||||
|
||||
// Another update request was triggered, keep the display link running
|
||||
if (wp->updateRequestPending)
|
||||
if (platformWindow->hasPendingUpdateRequest())
|
||||
pauseUpdates = false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user