summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2017-07-04 17:13:38 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2017-07-06 09:15:13 +0000
commit7beb2bc02bff9fa591eb60b978ed97d0601bedfd (patch)
tree0f1c464fdca1a05db223f5ea58138d76c63ce31d /src/plugins/platforms/windows
parente4c39d5e1e7ee8c2bba273e6d613ec519b7fa9c2 (diff)
[Windows] Update hMonitor handles when a display is turned off
In a multi-monitor setup, when the main display is turned off or disconnected, all remaining monitors have their hMonitor handle changed. Qt did not store these updated handles, which led to not posting the WindowScreenChanged event when a window was moved to a different DPI-scaled display, leading to e.g. improperly scaled popup menus. The fix consists in updating the hMonitor handles whenever a new monitor is connected or disconnected. Change-Id: Id2ca2c128510d9ff3e9746eb33e86dce8f6c4c83 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows')
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index 24fb12d27a..3a4793efcd 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -153,7 +153,8 @@ static QDebug operator<<(QDebug dbg, const QWindowsScreenData &d)
<< d.availableGeometry.width() << 'x' << d.availableGeometry.height() << '+' << d.availableGeometry.x() << '+' << d.availableGeometry.y()
<< " physical: " << d.physicalSizeMM.width() << 'x' << d.physicalSizeMM.height()
<< " DPI: " << d.dpi.first << 'x' << d.dpi.second << " Depth: " << d.depth
- << " Format: " << d.format;
+ << " Format: " << d.format
+ << " hMonitor: " << d.hMonitor;
if (d.flags & QWindowsScreenData::PrimaryScreen)
dbg << " primary";
if (d.flags & QWindowsScreenData::VirtualDesktop)
@@ -290,6 +291,13 @@ void QWindowsScreen::handleChanges(const QWindowsScreenData &newData)
{
m_data.physicalSizeMM = newData.physicalSizeMM;
+ if (m_data.hMonitor != newData.hMonitor) {
+ qCDebug(lcQpaWindows) << "Monitor" << m_data.name
+ << "has had its hMonitor handle changed from"
+ << m_data.hMonitor << "to" << newData.hMonitor;
+ 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;