summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmwindow.cpp
diff options
context:
space:
mode:
authorMorten Sørvig <[email protected]>2024-09-09 02:47:37 +0200
committerMorten Johan Sørvig <[email protected]>2024-10-22 16:53:57 +0000
commit2ab07b4558ce074fcd6cac699ea71df31fc324f5 (patch)
tree3237d6c2f7308546863340a7799b8f553f2d196b /src/plugins/platforms/wasm/qwasmwindow.cpp
parent8f7fc8e9af6a60b0610a4b7d04f22c5b1025931a (diff)
wasm: rename qt-window -> qt-decorated-window
This is the parent element for the window decorations (title bar, resize handles), and also the window contents. Task-number: QTBUG-128732 Change-Id: I9ba814a7cf8477ab767278fe6548cd05e83266ca Reviewed-by: Piotr Wierciński <[email protected]>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmwindow.cpp')
-rw-r--r--src/plugins/platforms/wasm/qwasmwindow.cpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/plugins/platforms/wasm/qwasmwindow.cpp b/src/plugins/platforms/wasm/qwasmwindow.cpp
index fee1b21c623..2bd9b86a0b7 100644
--- a/src/plugins/platforms/wasm/qwasmwindow.cpp
+++ b/src/plugins/platforms/wasm/qwasmwindow.cpp
@@ -54,21 +54,21 @@ QWasmWindow::QWasmWindow(QWindow *w, QWasmDeadKeySupport *deadKeySupport,
m_backingStore(backingStore),
m_deadKeySupport(deadKeySupport),
m_document(dom::document()),
- m_qtWindow(m_document.call<emscripten::val>("createElement", emscripten::val("div"))),
+ m_decoratedWindow(m_document.call<emscripten::val>("createElement", emscripten::val("div"))),
m_windowContents(m_document.call<emscripten::val>("createElement", emscripten::val("div"))),
m_a11yContainer(m_document.call<emscripten::val>("createElement", emscripten::val("div"))),
m_canvas(m_document.call<emscripten::val>("createElement", emscripten::val("canvas")))
{
- m_qtWindow.set("className", "qt-window");
- m_qtWindow["style"].set("display", std::string("none"));
+ m_decoratedWindow.set("className", "qt-decorated-window");
+ m_decoratedWindow["style"].set("display", std::string("none"));
- m_nonClientArea = std::make_unique<NonClientArea>(this, m_qtWindow);
+ m_nonClientArea = std::make_unique<NonClientArea>(this, m_decoratedWindow);
m_nonClientArea->titleBar()->setTitle(window()->title());
m_clientArea = std::make_unique<ClientArea>(this, compositor->screen(), m_windowContents);
m_windowContents.set("className", "qt-window-contents");
- m_qtWindow.call<void>("appendChild", m_windowContents);
+ m_decoratedWindow.call<void>("appendChild", m_windowContents);
m_canvas["classList"].call<void>("add", emscripten::val("qt-window-canvas"));
@@ -95,7 +95,7 @@ QWasmWindow::QWasmWindow(QWindow *w, QWasmDeadKeySupport *deadKeySupport,
m_context2d = m_canvas.call<emscripten::val>("getContext", emscripten::val("2d"));
static int serialNo = 0;
m_winId = ++serialNo;
- m_qtWindow.set("id", "qt-window-" + std::to_string(m_winId));
+ m_decoratedWindow.set("id", "qt-window-" + std::to_string(m_winId));
emscripten::val::module_property("specialHTMLTargets").set(canvasSelector(), m_canvas);
m_flags = window()->flags();
@@ -227,7 +227,7 @@ void QWasmWindow::paint()
void QWasmWindow::setZOrder(int z)
{
- m_qtWindow["style"].set("zIndex", std::to_string(z));
+ m_decoratedWindow["style"].set("zIndex", std::to_string(z));
}
void QWasmWindow::setWindowCursor(QByteArray cssCursorName)
@@ -274,8 +274,8 @@ void QWasmWindow::setGeometry(const QRect &rect)
.adjusted(-margins.left(), -margins.top(), margins.right(), margins.bottom())
.translated(!parent() ? -screen()->geometry().topLeft() : QPoint());
- m_qtWindow["style"].set("left", std::to_string(frameRect.left()) + "px");
- m_qtWindow["style"].set("top", std::to_string(frameRect.top()) + "px");
+ m_decoratedWindow["style"].set("left", std::to_string(frameRect.left()) + "px");
+ m_decoratedWindow["style"].set("top", std::to_string(frameRect.top()) + "px");
m_canvas["style"].set("width", std::to_string(clientAreaRect.width()) + "px");
m_canvas["style"].set("height", std::to_string(clientAreaRect.height()) + "px");
m_a11yContainer["style"].set("width", std::to_string(clientAreaRect.width()) + "px");
@@ -304,12 +304,12 @@ void QWasmWindow::setGeometry(const QRect &rect)
void QWasmWindow::setVisible(bool visible)
{
// TODO(mikolajboc): isVisible()?
- const bool nowVisible = m_qtWindow["style"]["display"].as<std::string>() == "block";
+ const bool nowVisible = m_decoratedWindow["style"]["display"].as<std::string>() == "block";
if (visible == nowVisible)
return;
m_compositor->requestUpdateWindow(this, QRect(QPoint(0, 0), geometry().size()), QWasmCompositor::ExposeEventDelivery);
- m_qtWindow["style"].set("display", visible ? "block" : "none");
+ m_decoratedWindow["style"].set("display", visible ? "block" : "none");
if (window()->isActive())
m_canvas.call<void>("focus");
if (visible)
@@ -324,7 +324,7 @@ bool QWasmWindow::isVisible() const
QMargins QWasmWindow::frameMargins() const
{
const auto frameRect =
- QRectF::fromDOMRect(m_qtWindow.call<emscripten::val>("getBoundingClientRect"));
+ QRectF::fromDOMRect(m_decoratedWindow.call<emscripten::val>("getBoundingClientRect"));
const auto canvasRect =
QRectF::fromDOMRect(m_windowContents.call<emscripten::val>("getBoundingClientRect"));
return QMarginsF(canvasRect.left() - frameRect.left(), canvasRect.top() - frameRect.top(),
@@ -359,7 +359,7 @@ void QWasmWindow::propagateSizeHints()
void QWasmWindow::setOpacity(qreal level)
{
- m_qtWindow["style"].set("opacity", qBound(0.0, level, 1.0));
+ m_decoratedWindow["style"].set("opacity", qBound(0.0, level, 1.0));
}
void QWasmWindow::invalidate()
@@ -369,7 +369,7 @@ void QWasmWindow::invalidate()
void QWasmWindow::onActivationChanged(bool active)
{
- dom::syncCSSClassWith(m_qtWindow, "inactive", !active);
+ dom::syncCSSClassWith(m_decoratedWindow, "inactive", !active);
}
// Fix top level window flags in case only the type flags are passed.
@@ -399,11 +399,11 @@ void QWasmWindow::setWindowFlags(Qt::WindowFlags flags)
onPositionPreferenceChanged(positionPreferenceFromWindowFlags(flags));
}
m_flags = flags;
- 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());
- dom::syncCSSClassWith(m_qtWindow, "transparent-for-input",
+ dom::syncCSSClassWith(m_decoratedWindow, "frameless", !hasFrame() || !window()->isTopLevel());
+ dom::syncCSSClassWith(m_decoratedWindow, "has-border", hasBorder());
+ dom::syncCSSClassWith(m_decoratedWindow, "has-shadow", hasShadow());
+ dom::syncCSSClassWith(m_decoratedWindow, "has-title", hasTitleBar());
+ dom::syncCSSClassWith(m_decoratedWindow, "transparent-for-input",
flags.testFlag(Qt::WindowTransparentForInput));
m_nonClientArea->titleBar()->setMaximizeVisible(hasMaximizeButton());
@@ -468,8 +468,8 @@ void QWasmWindow::applyWindowState()
else
newGeom = normalGeometry();
- dom::syncCSSClassWith(m_qtWindow, "has-border", hasBorder());
- dom::syncCSSClassWith(m_qtWindow, "maximized", isMaximized);
+ dom::syncCSSClassWith(m_decoratedWindow, "has-border", hasBorder());
+ dom::syncCSSClassWith(m_decoratedWindow, "maximized", isMaximized);
m_nonClientArea->titleBar()->setRestoreVisible(isMaximized);
m_nonClientArea->titleBar()->setMaximizeVisible(hasMaximizeButton());
@@ -724,10 +724,10 @@ bool QWasmWindow::windowEvent(QEvent *event)
{
switch (event->type()) {
case QEvent::WindowBlocked:
- m_qtWindow["classList"].call<void>("add", emscripten::val("blocked"));
+ m_decoratedWindow["classList"].call<void>("add", emscripten::val("blocked"));
return false; // Propagate further
case QEvent::WindowUnblocked:;
- m_qtWindow["classList"].call<void>("remove", emscripten::val("blocked"));
+ m_decoratedWindow["classList"].call<void>("remove", emscripten::val("blocked"));
return false; // Propagate further
default:
return QPlatformWindow::windowEvent(event);
@@ -737,7 +737,7 @@ bool QWasmWindow::windowEvent(QEvent *event)
void QWasmWindow::setMask(const QRegion &region)
{
if (region.isEmpty()) {
- m_qtWindow["style"].set("clipPath", emscripten::val(""));
+ m_decoratedWindow["style"].set("clipPath", emscripten::val(""));
return;
}
@@ -751,7 +751,7 @@ void QWasmWindow::setMask(const QRegion &region)
cssClipPath << "L " << cssRect.left() << " " << cssRect.bottom() << " z ";
}
cssClipPath << "')";
- m_qtWindow["style"].set("clipPath", emscripten::val(cssClipPath.str()));
+ m_decoratedWindow["style"].set("clipPath", emscripten::val(cssClipPath.str()));
}
void QWasmWindow::setParent(const QPlatformWindow *)
@@ -789,9 +789,9 @@ void QWasmWindow::onParentChanged(QWasmWindowTreeNode *previous, QWasmWindowTree
QWasmWindowStack::PositionPreference positionPreference)
{
if (previous)
- previous->containerElement().call<void>("removeChild", m_qtWindow);
+ previous->containerElement().call<void>("removeChild", m_decoratedWindow);
if (current)
- current->containerElement().call<void>("appendChild", m_qtWindow);
+ current->containerElement().call<void>("appendChild", m_decoratedWindow);
QWasmWindowTreeNode::onParentChanged(previous, current, positionPreference);
}