Windows QPA: Emit QGuiApplication::primaryScreenChanged()

Patch as contributed.

Pick-to: 6.5
Fixes: QTBUG-93368
Change-Id: I8cc884e64e84128b125415e78e3a34245ae4e626
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
(cherry picked from commit 01d55f0203e70e1345b068d940bc31026f181bf3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Friedemann Kleint 2023-11-08 11:00:35 +01:00 committed by Qt Cherry-pick Bot
parent 045f5baf90
commit 1248d78dbe

View File

@ -529,10 +529,14 @@ void QWindowsScreen::handleChanges(const QWindowsScreenData &newData)
const bool dpiChanged = !qFuzzyCompare(m_data.dpi.first, newData.dpi.first) const bool dpiChanged = !qFuzzyCompare(m_data.dpi.first, newData.dpi.first)
|| !qFuzzyCompare(m_data.dpi.second, newData.dpi.second); || !qFuzzyCompare(m_data.dpi.second, newData.dpi.second);
const bool orientationChanged = m_data.orientation != newData.orientation; const bool orientationChanged = m_data.orientation != newData.orientation;
const bool primaryChanged = (newData.flags & QWindowsScreenData::PrimaryScreen)
&& !(m_data.flags & QWindowsScreenData::PrimaryScreen);
m_data.dpi = newData.dpi; m_data.dpi = newData.dpi;
m_data.orientation = newData.orientation; m_data.orientation = newData.orientation;
m_data.geometry = newData.geometry; m_data.geometry = newData.geometry;
m_data.availableGeometry = newData.availableGeometry; m_data.availableGeometry = newData.availableGeometry;
m_data.flags = (m_data.flags & ~QWindowsScreenData::PrimaryScreen)
| (newData.flags & QWindowsScreenData::PrimaryScreen);
if (dpiChanged) { if (dpiChanged) {
QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(screen(), QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(screen(),
@ -545,6 +549,8 @@ void QWindowsScreen::handleChanges(const QWindowsScreenData &newData)
QWindowSystemInterface::handleScreenGeometryChange(screen(), QWindowSystemInterface::handleScreenGeometryChange(screen(),
newData.geometry, newData.availableGeometry); newData.geometry, newData.availableGeometry);
} }
if (primaryChanged)
QWindowSystemInterface::handlePrimaryScreenChanged(this);
} }
HMONITOR QWindowsScreen::handle() const HMONITOR QWindowsScreen::handle() const