From 7f4433b13dd855a8e7e928a3a57ef068cc5b1d3c Mon Sep 17 00:00:00 2001 From: Mikolaj Boc Date: Mon, 15 Aug 2022 18:36:51 +0200 Subject: [PATCH] Use the focus window to determine which window is drawn as active MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit window::isActive() is very lenient - it can determine that several windows are active at the same time, based on the active status of their parents, including transient parents. Use a stricter approach and only paint the window that has input focus as active. Fixes: QTBUG-105620 Pick-to: 6.4 Change-Id: I50ba45f633f693da2050c44415d8b6b154fc3099 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/wasm/qwasmwindow.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wasm/qwasmwindow.cpp b/src/plugins/platforms/wasm/qwasmwindow.cpp index ac0c810a434..fa1ced30fb0 100644 --- a/src/plugins/platforms/wasm/qwasmwindow.cpp +++ b/src/plugins/platforms/wasm/qwasmwindow.cpp @@ -543,10 +543,8 @@ QWasmWindow::TitleBarOptions QWasmWindow::makeTitleBarOptions() const titleBarOptions.palette = makePalette(); - if (window()->isActive()) - titleBarOptions.palette.setCurrentColorGroup(QPalette::Active); - else - titleBarOptions.palette.setCurrentColorGroup(QPalette::Inactive); + titleBarOptions.palette.setCurrentColorGroup( + QGuiApplication::focusWindow() == window() ? QPalette::Active : QPalette::Inactive); if (activeTitleBarControl() != SC_None) titleBarOptions.subControls = activeTitleBarControl();