From 503018ae070d9d39ab85b66499e14a8085adf51e Mon Sep 17 00:00:00 2001 From: Mikolaj Boc Date: Wed, 17 Aug 2022 08:42:20 +0200 Subject: [PATCH] Do not invalidate the entire window on window move on WASM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The invalidate on window move is redundant - the previous texture can be reused for the window. Just request another refresh on the compositor and don't update the window texture. Makes window moves smoother. Pick-to: 6.4 Change-Id: Ied2922a000d3c8e6143e64d029154d74bc4f3480 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/wasm/qwasmcompositor.cpp | 2 ++ src/plugins/platforms/wasm/qwasmwindow.cpp | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wasm/qwasmcompositor.cpp b/src/plugins/platforms/wasm/qwasmcompositor.cpp index 30c61d2668..959f3dbf2d 100644 --- a/src/plugins/platforms/wasm/qwasmcompositor.cpp +++ b/src/plugins/platforms/wasm/qwasmcompositor.cpp @@ -962,6 +962,8 @@ bool QWasmCompositor::processPointer(const PointerEvent& event) } m_windowManipulation.onPointerMove(event); + if (m_windowManipulation.operation() != WindowManipulation::Operation::None) + requestUpdate(); break; } case EventType::PointerEnter: diff --git a/src/plugins/platforms/wasm/qwasmwindow.cpp b/src/plugins/platforms/wasm/qwasmwindow.cpp index bfcc556d6d..5cdee1a8d0 100644 --- a/src/plugins/platforms/wasm/qwasmwindow.cpp +++ b/src/plugins/platforms/wasm/qwasmwindow.cpp @@ -84,11 +84,16 @@ void QWasmWindow::setGeometry(const QRect &rect) if (r.y() < yMin) r.moveTop(yMin); } - if (!m_windowState.testFlag(Qt::WindowFullScreen) && !m_windowState.testFlag(Qt::WindowMaximized)) + bool shouldInvalidate = true; + if (!m_windowState.testFlag(Qt::WindowFullScreen) + && !m_windowState.testFlag(Qt::WindowMaximized)) { + shouldInvalidate = m_normalGeometry.size() != r.size(); m_normalGeometry = r; + } QPlatformWindow::setGeometry(r); QWindowSystemInterface::handleGeometryChange(window(), r); - invalidate(); + if (shouldInvalidate) + invalidate(); } void QWasmWindow::setVisible(bool visible)