Windows QPA: Fix emitting of QScreen's changed signals
When changing the primary screen, the various changed signals of QScreen were out of order. Most notably, the wrong DPI value was emitted since QGuiApplicationPrivate::processScreenGeometryChange() checks and emits DPI and orientation as well. Rearrange the code to assign new the values and emit DPI first. Task-number: QTBUG-76902 Change-Id: If4037108391c36ab3a8bfcb9b2989d5bea41202f Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>bb10
parent
4f26f05869
commit
05bb156aaa
|
|
@ -303,23 +303,28 @@ void QWindowsScreen::handleChanges(const QWindowsScreenData &newData)
|
|||
m_data.hMonitor = newData.hMonitor;
|
||||
}
|
||||
|
||||
if (m_data.geometry != newData.geometry || m_data.availableGeometry != newData.availableGeometry) {
|
||||
m_data.geometry = newData.geometry;
|
||||
m_data.availableGeometry = newData.availableGeometry;
|
||||
QWindowSystemInterface::handleScreenGeometryChange(screen(),
|
||||
newData.geometry, newData.availableGeometry);
|
||||
}
|
||||
if (!qFuzzyCompare(m_data.dpi.first, newData.dpi.first)
|
||||
|| !qFuzzyCompare(m_data.dpi.second, newData.dpi.second)) {
|
||||
m_data.dpi = newData.dpi;
|
||||
// QGuiApplicationPrivate::processScreenGeometryChange() checks and emits
|
||||
// DPI and orientation as well, so, assign new values and emit DPI first.
|
||||
const bool geometryChanged = m_data.geometry != newData.geometry
|
||||
|| m_data.availableGeometry != newData.availableGeometry;
|
||||
const bool dpiChanged = !qFuzzyCompare(m_data.dpi.first, newData.dpi.first)
|
||||
|| !qFuzzyCompare(m_data.dpi.second, newData.dpi.second);
|
||||
const bool orientationChanged = m_data.orientation != newData.orientation;
|
||||
m_data.dpi = newData.dpi;
|
||||
m_data.orientation = newData.orientation;
|
||||
m_data.geometry = newData.geometry;
|
||||
m_data.availableGeometry = newData.availableGeometry;
|
||||
|
||||
if (dpiChanged) {
|
||||
QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(screen(),
|
||||
newData.dpi.first,
|
||||
newData.dpi.second);
|
||||
}
|
||||
if (m_data.orientation != newData.orientation) {
|
||||
m_data.orientation = newData.orientation;
|
||||
QWindowSystemInterface::handleScreenOrientationChange(screen(),
|
||||
newData.orientation);
|
||||
if (orientationChanged)
|
||||
QWindowSystemInterface::handleScreenOrientationChange(screen(), newData.orientation);
|
||||
if (geometryChanged) {
|
||||
QWindowSystemInterface::handleScreenGeometryChange(screen(),
|
||||
newData.geometry, newData.availableGeometry);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue