wasm: fix window activation

This fixes window activation of dialogs and tooltips

In the case of tooltips, We were activating the window
being removed.
In the case of dialogs, we need to raise the window
before requesting the activation.

Change-Id: Ie989e6d92afedf1895b5e188f0695f6254d70272
Fixes: QTBUG-94918
Pick-to: 5.15 6.2
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Lorn Potter 2021-08-09 19:15:31 +10:00
parent b1820295e1
commit 3d89257ce4
3 changed files with 9 additions and 1 deletions

View File

@ -131,8 +131,8 @@ void QWasmCompositor::removeWindow(QWasmWindow *window)
if (!m_windowStack.isEmpty() && !QGuiApplication::focusWindow()) { if (!m_windowStack.isEmpty() && !QGuiApplication::focusWindow()) {
auto lastWindow = m_windowStack.last(); auto lastWindow = m_windowStack.last();
lastWindow->requestActivateWindow(); lastWindow->requestActivateWindow();
notifyTopWindowChanged(lastWindow);
} }
notifyTopWindowChanged(window);
} }
void QWasmCompositor::setVisible(QWasmWindow *window, bool visible) void QWasmCompositor::setVisible(QWasmWindow *window, bool visible)

View File

@ -423,4 +423,11 @@ bool QWasmWindow::windowIsPopupType(Qt::WindowType type) const
return false; return false;
} }
void QWasmWindow::requestActivateWindow()
{
if (window()->isTopLevel())
raise();
QPlatformWindow::requestActivateWindow();
}
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -74,6 +74,7 @@ public:
QRect normalGeometry() const override; QRect normalGeometry() const override;
qreal devicePixelRatio() const override; qreal devicePixelRatio() const override;
void requestUpdate() override; void requestUpdate() override;
void requestActivateWindow() override;
QWasmScreen *platformScreen() const; QWasmScreen *platformScreen() const;
void setBackingStore(QWasmBackingStore *store) { m_backingStore = store; } void setBackingStore(QWasmBackingStore *store) { m_backingStore = store; }