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);
|
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.
|
Delivers an QEvent::UpdateRequest event to the window.
|
||||||
|
|
||||||
@ -757,6 +767,8 @@ void QPlatformWindow::requestUpdate()
|
|||||||
*/
|
*/
|
||||||
void QPlatformWindow::deliverUpdateRequest()
|
void QPlatformWindow::deliverUpdateRequest()
|
||||||
{
|
{
|
||||||
|
Q_ASSERT(hasPendingUpdateRequest());
|
||||||
|
|
||||||
QWindow *w = window();
|
QWindow *w = window();
|
||||||
QWindowPrivate *wp = qt_window_private(w);
|
QWindowPrivate *wp = qt_window_private(w);
|
||||||
wp->updateRequestPending = false;
|
wp->updateRequestPending = false;
|
||||||
|
@ -144,6 +144,7 @@ public:
|
|||||||
const QRect &initialGeometry, int defaultWidth, int defaultHeight);
|
const QRect &initialGeometry, int defaultWidth, int defaultHeight);
|
||||||
|
|
||||||
virtual void requestUpdate();
|
virtual void requestUpdate();
|
||||||
|
bool hasPendingUpdateRequest() const;
|
||||||
virtual void deliverUpdateRequest();
|
virtual void deliverUpdateRequest();
|
||||||
|
|
||||||
// Window property accessors. Platform plugins should use these
|
// Window property accessors. Platform plugins should use these
|
||||||
|
@ -115,17 +115,15 @@
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QWindowPrivate *windowPrivate = qt_window_private(m_platformWindow->window());
|
|
||||||
|
|
||||||
if (m_updateRequested) {
|
if (m_updateRequested) {
|
||||||
Q_ASSERT(windowPrivate->updateRequestPending);
|
Q_ASSERT(m_platformWindow->hasPendingUpdateRequest());
|
||||||
m_platformWindow->deliverUpdateRequest();
|
m_platformWindow->deliverUpdateRequest();
|
||||||
m_updateRequested = false;
|
m_updateRequested = false;
|
||||||
} else {
|
} else {
|
||||||
m_platformWindow->handleExposeEvent(dirtyRegion);
|
m_platformWindow->handleExposeEvent(dirtyRegion);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (windowPrivate->updateRequestPending) {
|
if (m_platformWindow->hasPendingUpdateRequest()) {
|
||||||
// A call to QWindow::requestUpdate was issued during event delivery above,
|
// A call to QWindow::requestUpdate was issued during event delivery above,
|
||||||
// but AppKit will reset the needsDisplay state of the view after completing
|
// 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.
|
// 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)
|
if (platformScreenForWindow(window) != this)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QWindowPrivate *wp = qt_window_private(window);
|
|
||||||
if (!wp->updateRequestPending)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
QPlatformWindow *platformWindow = window->handle();
|
QPlatformWindow *platformWindow = window->handle();
|
||||||
if (!platformWindow)
|
if (!platformWindow)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (!platformWindow->hasPendingUpdateRequest())
|
||||||
|
continue;
|
||||||
|
|
||||||
platformWindow->deliverUpdateRequest();
|
platformWindow->deliverUpdateRequest();
|
||||||
|
|
||||||
// Another update request was triggered, keep the display link running
|
// Another update request was triggered, keep the display link running
|
||||||
if (wp->updateRequestPending)
|
if (platformWindow->hasPendingUpdateRequest())
|
||||||
pauseUpdates = false;
|
pauseUpdates = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user