From 1f92cff4934572e454c563d420e23924e43ae818 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Thu, 9 Sep 2021 13:09:10 +0200 Subject: [PATCH] More user friendly monitor name on Windows 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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vncviewer/MonitorArrangement.cxx b/vncviewer/MonitorArrangement.cxx index a8813fe4..2a864175 100644 --- a/vncviewer/MonitorArrangement.cxx +++ b/vncviewer/MonitorArrangement.cxx @@ -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 ""; -- 2.39.5