Remove the redundant QWasmCompositor::requestUpdateAllWindows
Now that the browser compositor is used for rendering windows, the method has become redundant, as windows that got resized during screen resize will schedule their updates directly with the compositor. This also fixes an assertion in QPlatformWindow::hasPendingUpdateRequest as no windows without pending update requests will now have update requests delivered. Also offers a significant speedup with multiple restored window setups. Fixes: QTBUG-112289 Change-Id: Ie5dff69c04d66c4aef8351adef0da8530daf7ab8 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
This commit is contained in:
parent
c4b62ee501
commit
80c1406371
@ -151,12 +151,6 @@ QWindow *QWasmCompositor::keyWindow() const
|
||||
return m_activeWindow ? m_activeWindow->window() : nullptr;
|
||||
}
|
||||
|
||||
void QWasmCompositor::requestUpdateAllWindows()
|
||||
{
|
||||
m_requestUpdateAllWindows = true;
|
||||
requestUpdate();
|
||||
}
|
||||
|
||||
void QWasmCompositor::requestUpdateWindow(QWasmWindow *window, UpdateRequestDeliveryType updateType)
|
||||
{
|
||||
auto it = m_requestUpdateWindows.find(window);
|
||||
@ -198,36 +192,27 @@ void QWasmCompositor::deliverUpdateRequests()
|
||||
// update set.
|
||||
auto requestUpdateWindows = m_requestUpdateWindows;
|
||||
m_requestUpdateWindows.clear();
|
||||
bool requestUpdateAllWindows = m_requestUpdateAllWindows;
|
||||
m_requestUpdateAllWindows = false;
|
||||
|
||||
// Update window content, either all windows or a spesific set of windows. Use the correct
|
||||
// update type: QWindow subclasses expect that requested and delivered updateRequests matches
|
||||
// exactly.
|
||||
m_inDeliverUpdateRequest = true;
|
||||
if (requestUpdateAllWindows) {
|
||||
for (QWasmWindow *window : m_windowStack) {
|
||||
auto it = requestUpdateWindows.find(window);
|
||||
UpdateRequestDeliveryType updateType =
|
||||
(it == m_requestUpdateWindows.end() ? ExposeEventDelivery : it.value());
|
||||
deliverUpdateRequest(window, updateType);
|
||||
}
|
||||
} else {
|
||||
|
||||
for (auto it = requestUpdateWindows.constBegin(); it != requestUpdateWindows.constEnd(); ++it) {
|
||||
auto *window = it.key();
|
||||
UpdateRequestDeliveryType updateType = it.value();
|
||||
deliverUpdateRequest(window, updateType);
|
||||
}
|
||||
}
|
||||
|
||||
m_inDeliverUpdateRequest = false;
|
||||
frame(requestUpdateAllWindows, requestUpdateWindows.keys());
|
||||
frame(requestUpdateWindows.keys());
|
||||
}
|
||||
|
||||
void QWasmCompositor::deliverUpdateRequest(QWasmWindow *window, UpdateRequestDeliveryType updateType)
|
||||
{
|
||||
// update by deliverUpdateRequest and expose event accordingly.
|
||||
if (updateType == UpdateRequestDelivery) {
|
||||
window->QPlatformWindow::deliverUpdateRequest();
|
||||
window->deliverUpdateRequest();
|
||||
} else {
|
||||
QWindow *qwindow = window->window();
|
||||
QWindowSystemInterface::handleExposeEvent(
|
||||
@ -248,18 +233,13 @@ int dpiScaled(qreal value)
|
||||
return value * (qreal(qt_defaultDpiX()) / 96.0);
|
||||
}
|
||||
|
||||
void QWasmCompositor::frame(bool all, const QList<QWasmWindow *> &windows)
|
||||
void QWasmCompositor::frame(const QList<QWasmWindow *> &windows)
|
||||
{
|
||||
if (!m_isEnabled || m_windowStack.empty() || !screen())
|
||||
if (!m_isEnabled || !screen())
|
||||
return;
|
||||
|
||||
if (all) {
|
||||
std::for_each(m_windowStack.rbegin(), m_windowStack.rend(),
|
||||
[](QWasmWindow *window) { window->paint(); });
|
||||
} else {
|
||||
std::for_each(windows.begin(), windows.end(), [](QWasmWindow *window) { window->paint(); });
|
||||
}
|
||||
}
|
||||
|
||||
void QWasmCompositor::onTopWindowChanged()
|
||||
{
|
||||
|
@ -47,13 +47,13 @@ public:
|
||||
QWasmScreen *screen();
|
||||
|
||||
enum UpdateRequestDeliveryType { ExposeEventDelivery, UpdateRequestDelivery };
|
||||
void requestUpdateAllWindows();
|
||||
|
||||
void requestUpdateWindow(QWasmWindow *window, UpdateRequestDeliveryType updateType = ExposeEventDelivery);
|
||||
|
||||
void handleBackingStoreFlush(QWindow *window);
|
||||
|
||||
private:
|
||||
void frame(bool all, const QList<QWasmWindow *> &windows);
|
||||
void frame(const QList<QWasmWindow *> &windows);
|
||||
|
||||
void onTopWindowChanged();
|
||||
|
||||
@ -75,7 +75,6 @@ private:
|
||||
|
||||
bool m_isEnabled = true;
|
||||
QMap<QWasmWindow *, UpdateRequestDeliveryType> m_requestUpdateWindows;
|
||||
bool m_requestUpdateAllWindows = false;
|
||||
int m_requestAnimationFrameId = -1;
|
||||
bool m_inDeliverUpdateRequest = false;
|
||||
};
|
||||
|
@ -261,7 +261,6 @@ void QWasmScreen::updateQScreenAndCanvasRenderSize()
|
||||
};
|
||||
|
||||
setGeometry(QRect(getElementBodyPosition(m_shadowContainer), cssSize.toSize()));
|
||||
m_compositor->requestUpdateAllWindows();
|
||||
}
|
||||
|
||||
void QWasmScreen::canvasResizeObserverCallback(emscripten::val entries, emscripten::val)
|
||||
|
Loading…
x
Reference in New Issue
Block a user