summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsscreen.cpp
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2022-03-10 15:42:43 +0100
committerMorten Johan Sørvig <morten.sorvig@qt.io>2022-03-11 19:32:08 +0000
commit851dc581cf9a7672f4fa6a1235e3cd58e7411233 (patch)
treef4688a7d6c1113dc5a43fc4c8e730d95f43ff2bc /src/plugins/platforms/windows/qwindowsscreen.cpp
parent57c1e8d5339979cf124f28c58adc87c3d91a7fc2 (diff)
Revert "QScreen_win: retrieve user friendly monitor name"
This made the screen names be non-unique (in my case “28E850”), which causes the code in handleScreenChanges() to think they are the same screen. This reverts commit e9fd1c6aab28f027760da76ebc154f0ff9aefcf8. Pick-to: 6.3 6.2 Change-Id: I97fb76aeb66857b4bf9b3c5b4bd6db6024446798 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Yuhang Zhao <2546789017@qq.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsscreen.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index 0c639eb710..4474905744 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -151,20 +151,8 @@ static bool monitorData(HMONITOR hMonitor, QWindowsScreenData *data)
data->hMonitor = hMonitor;
data->geometry = QRect(QPoint(info.rcMonitor.left, info.rcMonitor.top), QPoint(info.rcMonitor.right - 1, info.rcMonitor.bottom - 1));
data->availableGeometry = QRect(QPoint(info.rcWork.left, info.rcWork.top), QPoint(info.rcWork.right - 1, info.rcWork.bottom - 1));
- DISPLAYCONFIG_PATH_INFO pathInfo = {};
- const bool hasPathInfo = getPathInfo(info, &pathInfo);
- if (hasPathInfo) {
- DISPLAYCONFIG_TARGET_DEVICE_NAME deviceName = {};
- deviceName.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME;
- deviceName.header.size = sizeof(DISPLAYCONFIG_TARGET_DEVICE_NAME);
- deviceName.header.adapterId = pathInfo.targetInfo.adapterId;
- deviceName.header.id = pathInfo.targetInfo.id;
- if (DisplayConfigGetDeviceInfo(&deviceName.header) == ERROR_SUCCESS)
- data->name = QString::fromWCharArray(deviceName.monitorFriendlyDeviceName);
- }
- if (data->name.isEmpty())
- data->name = QString::fromWCharArray(info.szDevice);
- if (wcscmp(info.szDevice, L"WinDisc") == 0) {
+ data->name = QString::fromWCharArray(info.szDevice);
+ if (data->name == u"WinDisc") {
data->flags |= QWindowsScreenData::LockScreen;
} else {
if (const HDC hdc = CreateDC(info.szDevice, nullptr, nullptr, nullptr)) {
@@ -186,7 +174,8 @@ static bool monitorData(HMONITOR hMonitor, QWindowsScreenData *data)
// ### We might want to consider storing adapterId/id from DISPLAYCONFIG_PATH_TARGET_INFO,
// if we are going to use DISPLAYCONFIG lookups more.
- if (hasPathInfo) {
+ DISPLAYCONFIG_PATH_INFO pathInfo = {};
+ if (getPathInfo(info, &pathInfo)) {
switch (pathInfo.targetInfo.rotation) {
case DISPLAYCONFIG_ROTATION_IDENTITY:
data->orientation = Qt::LandscapeOrientation;