Use the focus window to determine which window is drawn as active

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 <morten.sorvig@qt.io>
This commit is contained in:
Mikolaj Boc 2022-08-15 18:36:51 +02:00
parent a901afcd79
commit 7f4433b13d

View File

@ -543,10 +543,8 @@ QWasmWindow::TitleBarOptions QWasmWindow::makeTitleBarOptions() const
titleBarOptions.palette = makePalette(); titleBarOptions.palette = makePalette();
if (window()->isActive()) titleBarOptions.palette.setCurrentColorGroup(
titleBarOptions.palette.setCurrentColorGroup(QPalette::Active); QGuiApplication::focusWindow() == window() ? QPalette::Active : QPalette::Inactive);
else
titleBarOptions.palette.setCurrentColorGroup(QPalette::Inactive);
if (activeTitleBarControl() != SC_None) if (activeTitleBarControl() != SC_None)
titleBarOptions.subControls = activeTitleBarControl(); titleBarOptions.subControls = activeTitleBarControl();