]> source.dussan.org Git - tigervnc.git/commitdiff
More user friendly monitor name on Windows
authorPierre Ossman <ossman@cendio.se>
Thu, 9 Sep 2021 11:09:10 +0000 (13:09 +0200)
committerPierre Ossman <ossman@cendio.se>
Thu, 9 Sep 2021 11:20:14 +0000 (13:20 +0200)
The device name is very internal and likely of little use to a user.
Instead give the more user friendly string we can get out of the system.

(cherry picked from commit 6a1eaff040cab5984f9928fb2bba1a983f4c2fd0)

vncviewer/MonitorArrangement.cxx

index a8813fe468e46c11be4f8d7f91a3cf5da7025996..2a86417592f59a7f127dd55c3f9a90a429319476 100644 (file)
@@ -371,6 +371,7 @@ std::string MonitorArrangement::get_monitor_name(int m)
 
   for (iter = sys_monitors.begin(); iter != sys_monitors.end(); ++iter) {
     MONITORINFOEX info;
+    DISPLAY_DEVICE dev;
 
     info.cbSize = sizeof(info);
     GetMonitorInfo(*iter, (LPMONITORINFO)&info);
@@ -384,7 +385,10 @@ std::string MonitorArrangement::get_monitor_name(int m)
     if ((info.rcMonitor.bottom - info.rcMonitor.top) != h)
       continue;
 
-    return info.szDevice;
+    dev.cb = sizeof(dev);
+    EnumDisplayDevices(info.szDevice, 0, &dev, 0);
+
+    return dev.DeviceString;
   }
 
   return "";