summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/wasm/qwasmbackingstore.cpp9
-rw-r--r--src/plugins/platforms/wasm/qwasmcompositor.cpp31
-rw-r--r--src/plugins/platforms/wasm/qwasmcompositor.h9
-rw-r--r--src/plugins/platforms/wasm/qwasmwindow.cpp10
4 files changed, 36 insertions, 23 deletions
diff --git a/src/plugins/platforms/wasm/qwasmbackingstore.cpp b/src/plugins/platforms/wasm/qwasmbackingstore.cpp
index a3c1ae8a502..c14d1f59e4e 100644
--- a/src/plugins/platforms/wasm/qwasmbackingstore.cpp
+++ b/src/plugins/platforms/wasm/qwasmbackingstore.cpp
@@ -39,11 +39,12 @@ QPaintDevice *QWasmBackingStore::paintDevice()
void QWasmBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
{
Q_UNUSED(window);
- Q_UNUSED(region);
- Q_UNUSED(offset);
-
m_dirty |= region;
- m_compositor->handleBackingStoreFlush(window);
+
+ QRect updateRect = region.boundingRect();
+ updateRect.translate(offset);
+
+ m_compositor->handleBackingStoreFlush(this->window(), updateRect);
}
void QWasmBackingStore::updateTexture(QWasmWindow *window)
diff --git a/src/plugins/platforms/wasm/qwasmcompositor.cpp b/src/plugins/platforms/wasm/qwasmcompositor.cpp
index ef460f666ff..c534cce9ef5 100644
--- a/src/plugins/platforms/wasm/qwasmcompositor.cpp
+++ b/src/plugins/platforms/wasm/qwasmcompositor.cpp
@@ -55,16 +55,23 @@ bool QWasmCompositor::releaseRequestUpdateHold()
return wasEnabled;
}
-void QWasmCompositor::requestUpdateWindow(QWasmWindow *window, UpdateRequestDeliveryType updateType)
+void QWasmCompositor::requestUpdateWindow(QWasmWindow *window, const QRect &updateRect, UpdateRequestDeliveryType updateType)
{
auto it = m_requestUpdateWindows.find(window);
if (it == m_requestUpdateWindows.end()) {
- m_requestUpdateWindows.insert(window, updateType);
+ m_requestUpdateWindows.insert(window, std::make_tuple(updateRect, updateType));
} else {
// Already registered, but upgrade ExposeEventDeliveryType to UpdateRequestDeliveryType.
// if needed, to make sure QWindow::updateRequest's are matched.
- if (it.value() == ExposeEventDelivery && updateType == UpdateRequestDelivery)
- it.value() = UpdateRequestDelivery;
+ if (std::get<0>(it.value()) != updateRect) {
+ QRegion region;
+ region |= std::get<0>(it.value());
+ region |= updateRect;
+ std::get<0>(it.value()) = region.boundingRect();
+ }
+ if (std::get<1>(it.value()) == ExposeEventDelivery &&
+ updateType == UpdateRequestDelivery)
+ std::get<1>(it.value()) = UpdateRequestDelivery;
}
requestUpdate();
@@ -106,15 +113,20 @@ void QWasmCompositor::deliverUpdateRequests()
m_inDeliverUpdateRequest = true;
for (auto it = requestUpdateWindows.constBegin(); it != requestUpdateWindows.constEnd(); ++it) {
auto *window = it.key();
- UpdateRequestDeliveryType updateType = it.value();
- deliverUpdateRequest(window, updateType);
+
+ const QRect updateRect = std::get<0>(it.value());
+ const UpdateRequestDeliveryType updateType = std::get<1>(it.value());
+ deliverUpdateRequest(window, updateRect, updateType);
}
m_inDeliverUpdateRequest = false;
frame(requestUpdateWindows.keys());
}
-void QWasmCompositor::deliverUpdateRequest(QWasmWindow *window, UpdateRequestDeliveryType updateType)
+void QWasmCompositor::deliverUpdateRequest(
+ QWasmWindow *window,
+ const QRect &updateRect,
+ UpdateRequestDeliveryType updateType)
{
QWindow *qwindow = window->window();
@@ -126,7 +138,6 @@ void QWasmCompositor::deliverUpdateRequest(QWasmWindow *window, UpdateRequestDel
// type. If the window has not yet been exposed then we must expose it first regardless
// of update type. The deliverUpdateRequest must still be sent in this case in order
// to maintain correct window update state.
- QRect updateRect(QPoint(0, 0), qwindow->geometry().size());
if (updateType == UpdateRequestDelivery) {
if (qwindow->isExposed() == false)
QWindowSystemInterface::handleExposeEvent(qwindow, updateRect);
@@ -136,12 +147,12 @@ void QWasmCompositor::deliverUpdateRequest(QWasmWindow *window, UpdateRequestDel
}
}
-void QWasmCompositor::handleBackingStoreFlush(QWindow *window)
+void QWasmCompositor::handleBackingStoreFlush(QWindow *window, const QRect &updateRect)
{
// Request update to flush the updated backing store content, unless we are currently
// processing an update, in which case the new content will flushed as a part of that update.
if (!m_inDeliverUpdateRequest)
- requestUpdateWindow(static_cast<QWasmWindow *>(window->handle()));
+ requestUpdateWindow(static_cast<QWasmWindow *>(window->handle()), updateRect);
}
void QWasmCompositor::frame(const QList<QWasmWindow *> &windows)
diff --git a/src/plugins/platforms/wasm/qwasmcompositor.h b/src/plugins/platforms/wasm/qwasmcompositor.h
index 4953d652338..0f24a6690e7 100644
--- a/src/plugins/platforms/wasm/qwasmcompositor.h
+++ b/src/plugins/platforms/wasm/qwasmcompositor.h
@@ -9,6 +9,7 @@
#include <qpa/qplatformwindow.h>
#include <QMap>
+#include <tuple>
QT_BEGIN_NAMESPACE
@@ -35,9 +36,9 @@ public:
void requestUpdate();
enum UpdateRequestDeliveryType { ExposeEventDelivery, UpdateRequestDelivery };
- void requestUpdateWindow(QWasmWindow *window, UpdateRequestDeliveryType updateType = ExposeEventDelivery);
+ void requestUpdateWindow(QWasmWindow *window, const QRect &updateRect, UpdateRequestDeliveryType updateType = ExposeEventDelivery);
- void handleBackingStoreFlush(QWindow *window);
+ void handleBackingStoreFlush(QWindow *window, const QRect &updateRect);
void onWindowTreeChanged(QWasmWindowTreeNodeChangeType changeType, QWasmWindow *window);
private:
@@ -46,10 +47,10 @@ private:
void deregisterEventHandlers();
void deliverUpdateRequests();
- void deliverUpdateRequest(QWasmWindow *window, UpdateRequestDeliveryType updateType);
+ void deliverUpdateRequest(QWasmWindow *window, const QRect &updateRect, UpdateRequestDeliveryType updateType);
bool m_isEnabled = true;
- QMap<QWasmWindow *, UpdateRequestDeliveryType> m_requestUpdateWindows;
+ QMap<QWasmWindow *, std::tuple<QRect, UpdateRequestDeliveryType>> m_requestUpdateWindows;
int m_requestAnimationFrameId = -1;
bool m_inDeliverUpdateRequest = false;
static bool m_requestUpdateHoldEnabled;
diff --git a/src/plugins/platforms/wasm/qwasmwindow.cpp b/src/plugins/platforms/wasm/qwasmwindow.cpp
index 99e9bb22f1b..6fa56f1d064 100644
--- a/src/plugins/platforms/wasm/qwasmwindow.cpp
+++ b/src/plugins/platforms/wasm/qwasmwindow.cpp
@@ -317,7 +317,7 @@ void QWasmWindow::setGeometry(const QRect &rect)
if (shouldInvalidate)
invalidate();
else
- m_compositor->requestUpdateWindow(this);
+ m_compositor->requestUpdateWindow(this, QRect(QPoint(0, 0), geometry().size()));
}
void QWasmWindow::setVisible(bool visible)
@@ -327,7 +327,7 @@ void QWasmWindow::setVisible(bool visible)
if (visible == nowVisible)
return;
- m_compositor->requestUpdateWindow(this, QWasmCompositor::ExposeEventDelivery);
+ m_compositor->requestUpdateWindow(this, QRect(QPoint(0, 0), geometry().size()), QWasmCompositor::ExposeEventDelivery);
m_qtWindow["style"].set("display", visible ? "block" : "none");
if (window()->isActive())
m_canvas.call<void>("focus");
@@ -385,7 +385,7 @@ void QWasmWindow::setOpacity(qreal level)
void QWasmWindow::invalidate()
{
- m_compositor->requestUpdateWindow(this);
+ m_compositor->requestUpdateWindow(this, QRect(QPoint(0, 0), geometry().size()));
}
void QWasmWindow::onActivationChanged(bool active)
@@ -401,7 +401,7 @@ void QWasmWindow::setWindowFlags(Qt::WindowFlags flags)
onPositionPreferenceChanged(positionPreferenceFromWindowFlags(flags));
}
m_flags = flags;
- dom::syncCSSClassWith(m_qtWindow, "frameless", !hasFrame());
+ dom::syncCSSClassWith(m_qtWindow, "frameless", !hasFrame() || !window()->isTopLevel());
dom::syncCSSClassWith(m_qtWindow, "has-border", hasBorder());
dom::syncCSSClassWith(m_qtWindow, "has-shadow", hasShadow());
dom::syncCSSClassWith(m_qtWindow, "has-title", hasTitleBar());
@@ -566,7 +566,7 @@ qreal QWasmWindow::devicePixelRatio() const
void QWasmWindow::requestUpdate()
{
- m_compositor->requestUpdateWindow(this, QWasmCompositor::UpdateRequestDelivery);
+ m_compositor->requestUpdateWindow(this, QRect(QPoint(0, 0), geometry().size()), QWasmCompositor::UpdateRequestDelivery);
}
bool QWasmWindow::hasFrame() const