wasm: don't make normal-state windows StaysOnBottom

Setting StaysOnBottom creates a special case where
the first window is always kept at the bottom of the
window stack.

However this becomes confusing if the first window
is not maximized or fullscreen, since it's then not
possible to bring it to front by clicking the title bar.

Add a check on the window state, and set WindowStaysOnBottomHint
for maximized or fullscreen windows only.

Pick-to: 6.8
Change-Id: I0f43874cfcdc7c951c47cd278f5acdd42368cd5a
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
This commit is contained in:
Morten Sørvig 2024-06-07 13:00:30 +02:00 committed by Morten Johan Sørvig
parent 4b32420243
commit 1d612c5100

View File

@ -266,9 +266,13 @@ void QWasmScreen::onSubtreeChanged(QWasmWindowTreeNodeChangeType changeType,
QWasmWindowTreeNode *parent, QWasmWindow *child) QWasmWindowTreeNode *parent, QWasmWindow *child)
{ {
Q_UNUSED(parent); Q_UNUSED(parent);
QWindow *window = child->window();
const bool isMaxFull = (window->windowState() & Qt::WindowMaximized) ||
(window->windowState() & Qt::WindowFullScreen);
if (changeType == QWasmWindowTreeNodeChangeType::NodeInsertion && parent == this if (changeType == QWasmWindowTreeNodeChangeType::NodeInsertion && parent == this
&& childStack().size() == 1) { && childStack().size() == 1 && isMaxFull) {
child->window()->setFlag(Qt::WindowStaysOnBottomHint); window->setFlag(Qt::WindowStaysOnBottomHint);
} }
QWasmWindowTreeNode::onSubtreeChanged(changeType, parent, child); QWasmWindowTreeNode::onSubtreeChanged(changeType, parent, child);
m_compositor->onWindowTreeChanged(changeType, child); m_compositor->onWindowTreeChanged(changeType, child);