wasm: Render Qt::SubWindow borderless

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

Fixes: QTBUG-115054
Pick-to: 6.5 6.6
Change-Id: I7111df6057a087080194c1d46e350df839bec437
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
This commit is contained in:
Piotr Wierciński 2023-07-14 12:36:17 +02:00
parent 959a8b3967
commit 0493504f34
2 changed files with 16 additions and 5 deletions

View File

@ -411,10 +411,10 @@ void QWasmWindow::setWindowFlags(Qt::WindowFlags flags)
onPositionPreferenceChanged(positionPreferenceFromWindowFlags(flags)); onPositionPreferenceChanged(positionPreferenceFromWindowFlags(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));
@ -603,16 +603,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

@ -117,6 +117,8 @@ private:
QWasmWindowStack::PositionPreference positionPreference) final; QWasmWindowStack::PositionPreference positionPreference) final;
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;