udpate to qt 6.7.3

This commit is contained in:
kleuter
2024-11-12 15:55:53 +01:00
parent 61d77a3278
commit b9947d93c0
6 changed files with 52 additions and 17 deletions

View File

@ -142,6 +142,18 @@ struct DiRegKeyHandleTraits
using DiRegKeyHandle = QUniqueHandle<DiRegKeyHandleTraits>;
struct DevInfoHandleTraits
{
using Type = HDEVINFO;
static Type invalidValue()
{
return reinterpret_cast<HDEVINFO>(INVALID_HANDLE_VALUE);
}
static bool close(Type handle) { return SetupDiDestroyDeviceInfoList(handle) == TRUE; }
};
using DevInfoHandle = QUniqueHandle<DevInfoHandleTraits>;
}
static void setMonitorDataFromSetupApi(QWindowsScreenData &data,
@ -191,13 +203,16 @@ static void setMonitorDataFromSetupApi(QWindowsScreenData &data,
constexpr GUID GUID_DEVINTERFACE_MONITOR = {
0xe6f07b5f, 0xee97, 0x4a90, { 0xb0, 0x76, 0x33, 0xf5, 0x7b, 0xf4, 0xea, 0xa7 }
};
const HDEVINFO devInfo = SetupDiGetClassDevs(&GUID_DEVINTERFACE_MONITOR, nullptr, nullptr,
DIGCF_DEVICEINTERFACE);
const DevInfoHandle devInfo{ SetupDiGetClassDevs(
&GUID_DEVINTERFACE_MONITOR, nullptr, nullptr, DIGCF_DEVICEINTERFACE) };
if (!devInfo.isValid())
continue;
SP_DEVICE_INTERFACE_DATA deviceInterfaceData{};
deviceInterfaceData.cbSize = sizeof(deviceInterfaceData);
if (!SetupDiOpenDeviceInterfaceW(devInfo, deviceName.monitorDevicePath, DIODI_NO_ADD,
if (!SetupDiOpenDeviceInterfaceW(devInfo.get(), deviceName.monitorDevicePath, DIODI_NO_ADD,
&deviceInterfaceData)) {
qCWarning(lcQpaScreen)
<< u"Unable to open monitor interface to %1:"_s.arg(data.deviceName)
@ -206,7 +221,7 @@ static void setMonitorDataFromSetupApi(QWindowsScreenData &data,
}
DWORD requiredSize{ 0 };
if (SetupDiGetDeviceInterfaceDetailW(devInfo, &deviceInterfaceData, nullptr, 0,
if (SetupDiGetDeviceInterfaceDetailW(devInfo.get(), &deviceInterfaceData, nullptr, 0,
&requiredSize, nullptr)
|| GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
continue;
@ -217,7 +232,7 @@ static void setMonitorDataFromSetupApi(QWindowsScreenData &data,
devicePath->cbSize = sizeof(std::remove_pointer_t<decltype(devicePath)>);
SP_DEVINFO_DATA deviceInfoData{};
deviceInfoData.cbSize = sizeof(deviceInfoData);
if (!SetupDiGetDeviceInterfaceDetailW(devInfo, &deviceInterfaceData, devicePath,
if (!SetupDiGetDeviceInterfaceDetailW(devInfo.get(), &deviceInterfaceData, devicePath,
requiredSize, nullptr, &deviceInfoData)) {
qCDebug(lcQpaScreen) << u"Unable to get monitor metadata for %1:"_s.arg(data.deviceName)
<< QSystemError::windowsString();
@ -225,7 +240,7 @@ static void setMonitorDataFromSetupApi(QWindowsScreenData &data,
}
const DiRegKeyHandle edidRegistryKey{ SetupDiOpenDevRegKey(
devInfo, &deviceInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_READ) };
devInfo.get(), &deviceInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_READ) };
if (!edidRegistryKey.isValid())
continue;