mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-07 16:54:14 +01:00
[dxgi] Preserve system monitor sort order in enumMonitors()
This commit is contained in:
parent
d4a7346198
commit
550e04c579
@ -18,7 +18,7 @@ namespace dxvk::wsi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct MonitorEnumInfo {
|
struct MonitorEnumInfo {
|
||||||
const WCHAR *gdiDeviceName;
|
std::set<std::wstring> *gdiDeviceNames;
|
||||||
UINT iMonitorId;
|
UINT iMonitorId;
|
||||||
HMONITOR oMonitor;
|
HMONITOR oMonitor;
|
||||||
};
|
};
|
||||||
@ -30,13 +30,13 @@ namespace dxvk::wsi {
|
|||||||
LPARAM lp) {
|
LPARAM lp) {
|
||||||
auto data = reinterpret_cast<MonitorEnumInfo*>(lp);
|
auto data = reinterpret_cast<MonitorEnumInfo*>(lp);
|
||||||
|
|
||||||
if (data->gdiDeviceName)
|
if (data->gdiDeviceNames)
|
||||||
{
|
{
|
||||||
MONITORINFOEXW monitorInfo;
|
MONITORINFOEXW monitorInfo;
|
||||||
|
|
||||||
monitorInfo.cbSize = sizeof(monitorInfo);
|
monitorInfo.cbSize = sizeof(monitorInfo);
|
||||||
GetMonitorInfoW(hmon, (MONITORINFO *)&monitorInfo);
|
GetMonitorInfoW(hmon, (MONITORINFO *)&monitorInfo);
|
||||||
if (wcscmp(data->gdiDeviceName, monitorInfo.szDevice))
|
if (data->gdiDeviceNames->find(monitorInfo.szDevice) == data->gdiDeviceNames->end())
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if (data->iMonitorId--)
|
if (data->iMonitorId--)
|
||||||
@ -49,7 +49,7 @@ namespace dxvk::wsi {
|
|||||||
MonitorEnumInfo info;
|
MonitorEnumInfo info;
|
||||||
info.iMonitorId = index;
|
info.iMonitorId = index;
|
||||||
info.oMonitor = nullptr;
|
info.oMonitor = nullptr;
|
||||||
info.gdiDeviceName = nullptr;
|
info.gdiDeviceNames = nullptr;
|
||||||
|
|
||||||
::EnumDisplayMonitors(
|
::EnumDisplayMonitors(
|
||||||
nullptr, nullptr, &MonitorEnumProc,
|
nullptr, nullptr, &MonitorEnumProc,
|
||||||
@ -65,6 +65,7 @@ namespace dxvk::wsi {
|
|||||||
std::vector<DISPLAYCONFIG_PATH_INFO> paths;
|
std::vector<DISPLAYCONFIG_PATH_INFO> paths;
|
||||||
std::vector<DISPLAYCONFIG_MODE_INFO> modes;
|
std::vector<DISPLAYCONFIG_MODE_INFO> modes;
|
||||||
std::set<std::pair<uint32_t, uint32_t>> sources;
|
std::set<std::pair<uint32_t, uint32_t>> sources;
|
||||||
|
std::set<std::wstring> gdiDeviceNames;
|
||||||
UINT32 pathCount = 0;
|
UINT32 pathCount = 0;
|
||||||
UINT32 modeCount = 0;
|
UINT32 modeCount = 0;
|
||||||
LONG result;
|
LONG result;
|
||||||
@ -93,6 +94,7 @@ namespace dxvk::wsi {
|
|||||||
MonitorEnumInfo info;
|
MonitorEnumInfo info;
|
||||||
info.iMonitorId = index;
|
info.iMonitorId = index;
|
||||||
info.oMonitor = nullptr;
|
info.oMonitor = nullptr;
|
||||||
|
info.gdiDeviceNames = &gdiDeviceNames;
|
||||||
|
|
||||||
for (const auto &path : paths) {
|
for (const auto &path : paths) {
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
@ -121,17 +123,13 @@ namespace dxvk::wsi {
|
|||||||
return enumMonitors(index);
|
return enumMonitors(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
info.gdiDeviceName = deviceName.viewGdiDeviceName;
|
gdiDeviceNames.insert(deviceName.viewGdiDeviceName);
|
||||||
|
}
|
||||||
::EnumDisplayMonitors(
|
::EnumDisplayMonitors(
|
||||||
nullptr, nullptr, &MonitorEnumProc,
|
nullptr, nullptr, &MonitorEnumProc,
|
||||||
reinterpret_cast<LPARAM>(&info));
|
reinterpret_cast<LPARAM>(&info));
|
||||||
|
|
||||||
if (info.oMonitor != nullptr)
|
|
||||||
return info.oMonitor;
|
return info.oMonitor;
|
||||||
}
|
}
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool getDisplayName(
|
bool getDisplayName(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user