]> git.tdb.fi Git - libs/gui.git/commitdiff
Retrieve correct names for monitors on Windows
authorMikko Rasa <tdb@tdb.fi>
Wed, 4 Jan 2023 18:21:02 +0000 (20:21 +0200)
committerMikko Rasa <tdb@tdb.fi>
Wed, 4 Jan 2023 18:21:02 +0000 (20:21 +0200)
source/graphics/windows/display.cpp

index 09ca2e9edab55530bdc796dedc796141e6fa01ef..359df9e39b7f16023022e0f662edc002b62c191b 100644 (file)
@@ -29,9 +29,13 @@ Display::Display(const string &):
                monitors.push_back(Monitor());
                Monitor &monitor = monitors.back();
                monitor.index = monitors.size()-1;
-               monitor.name = adapter_dev.DeviceString;
                priv->monitors.push_back(adapter_dev.DeviceName);
 
+               DISPLAY_DEVICE monitor_dev;
+               monitor_dev.cb = sizeof(monitor_dev);
+               if(EnumDisplayDevices(adapter_dev.DeviceName, 0, &monitor_dev, 0))
+                       monitor.name = monitor_dev.DeviceString;
+
                if(adapter_dev.StateFlags&DISPLAY_DEVICE_PRIMARY_DEVICE)
                        primary_index = i;