From a89754a2f322576d6d780976888ca517f48c26c3 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Thu, 20 May 2021 15:57:30 +1000 Subject: [PATCH] wasm: fix tooltips show/hide behavior MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When tool tip was trying to show its window became activated causing tool tip to hide instantly due to a redundant window activation bug on show/hide/raise/lower. Fixes: QTBUG-91095 Change-Id: Id215400a79cdc4ed1961731949ca139b575eec88 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/wasm/qwasmcompositor.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wasm/qwasmcompositor.cpp b/src/plugins/platforms/wasm/qwasmcompositor.cpp index 9a16ae7719..3883bf3c95 100644 --- a/src/plugins/platforms/wasm/qwasmcompositor.cpp +++ b/src/plugins/platforms/wasm/qwasmcompositor.cpp @@ -110,6 +110,9 @@ void QWasmCompositor::addWindow(QWasmWindow *window, QWasmWindow *parentWindow) else m_compositedWindows[parentWindow].childWindows.append(window); + if (!QGuiApplication::focusWindow()) { + window->requestActivateWindow(); + } notifyTopWindowChanged(window); } @@ -125,6 +128,10 @@ void QWasmCompositor::removeWindow(QWasmWindow *window) m_windowStack.removeAll(window); m_compositedWindows.remove(window); + if (!m_windowStack.isEmpty() && !QGuiApplication::focusWindow()) { + auto lastWindow = m_windowStack.last(); + lastWindow->requestActivateWindow(); + } notifyTopWindowChanged(window); } @@ -734,12 +741,13 @@ void QWasmCompositor::notifyTopWindowChanged(QWasmWindow *window) bool blocked = QGuiApplicationPrivate::instance()->isWindowBlocked(window->window(), &modalWindow); if (blocked) { + modalWindow->requestActivate(); raise(static_cast(modalWindow->handle())); return; } requestRedraw(); - QWindowSystemInterface::handleWindowActivated(window->window()); + } QWasmScreen *QWasmCompositor::screen()