wasm: Render Qt::SubWindow borderless

Windows with Qt::SubWindow flag should not have platform decoration.

Fixes: QTBUG-115054
Change-Id: I7111df6057a087080194c1d46e350df839bec437
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 0493504f34c6673e05be630d8096cf2a78a780b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Piotr Wierciński 2023-07-14 12:36:17 +02:00 committed by Qt Cherry-pick Bot
parent c3efe23ad1
commit b9c4fb7e61
2 changed files with 16 additions and 5 deletions

View File

@ -392,10 +392,10 @@ void QWasmWindow::setWindowFlags(Qt::WindowFlags flags)
if (flags.testFlag(Qt::WindowStaysOnTopHint) != m_flags.testFlag(Qt::WindowStaysOnTopHint)) if (flags.testFlag(Qt::WindowStaysOnTopHint) != m_flags.testFlag(Qt::WindowStaysOnTopHint))
m_compositor->windowPositionPreferenceChanged(this, flags); m_compositor->windowPositionPreferenceChanged(this, flags);
m_flags = flags; m_flags = flags;
dom::syncCSSClassWith(m_qtWindow, "frameless", !hasFrame());
dom::syncCSSClassWith(m_qtWindow, "has-border", hasBorder()); dom::syncCSSClassWith(m_qtWindow, "has-border", hasBorder());
dom::syncCSSClassWith(m_qtWindow, "has-shadow", hasShadow()); dom::syncCSSClassWith(m_qtWindow, "has-shadow", hasShadow());
dom::syncCSSClassWith(m_qtWindow, "has-title", flags.testFlag(Qt::WindowTitleHint)); dom::syncCSSClassWith(m_qtWindow, "has-title", hasTitleBar());
dom::syncCSSClassWith(m_qtWindow, "frameless", flags.testFlag(Qt::FramelessWindowHint));
dom::syncCSSClassWith(m_qtWindow, "transparent-for-input", dom::syncCSSClassWith(m_qtWindow, "transparent-for-input",
flags.testFlag(Qt::WindowTransparentForInput)); flags.testFlag(Qt::WindowTransparentForInput));
@ -578,16 +578,25 @@ void QWasmWindow::requestUpdate()
m_compositor->requestUpdateWindow(this, QWasmCompositor::UpdateRequestDelivery); m_compositor->requestUpdateWindow(this, QWasmCompositor::UpdateRequestDelivery);
} }
bool QWasmWindow::hasFrame() const
{
return !m_flags.testFlag(Qt::FramelessWindowHint);
}
bool QWasmWindow::hasBorder() const bool QWasmWindow::hasBorder() const
{ {
return !m_state.testFlag(Qt::WindowFullScreen) && !m_flags.testFlag(Qt::FramelessWindowHint) return hasFrame() && !m_state.testFlag(Qt::WindowFullScreen) && !m_flags.testFlag(Qt::SubWindow)
&& !windowIsPopupType(m_flags); && !windowIsPopupType(m_flags);
} }
bool QWasmWindow::hasTitleBar() const
{
return hasBorder() && m_flags.testFlag(Qt::WindowTitleHint);
}
bool QWasmWindow::hasShadow() const bool QWasmWindow::hasShadow() const
{ {
return !m_flags.testFlag(Qt::NoDropShadowWindowHint) return hasBorder() && !m_flags.testFlag(Qt::NoDropShadowWindowHint);
&& !m_flags.testFlag(Qt::FramelessWindowHint);
} }
bool QWasmWindow::hasMaximizeButton() const bool QWasmWindow::hasMaximizeButton() const

View File

@ -103,6 +103,8 @@ private:
static constexpr auto minSizeForRegularWindows = 100; static constexpr auto minSizeForRegularWindows = 100;
void invalidate(); void invalidate();
bool hasFrame() const;
bool hasTitleBar() const;
bool hasBorder() const; bool hasBorder() const;
bool hasShadow() const; bool hasShadow() const;
bool hasMaximizeButton() const; bool hasMaximizeButton() const;