mirror of
https://github.com/glfw/glfw.git
synced 2024-12-01 16:44:37 +00:00
Clarify Win32 monitor physical size retrieval
This commit is contained in:
parent
25878d68e0
commit
afb04c9133
@ -112,6 +112,8 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
|||||||
for (adapterIndex = 0; ; adapterIndex++)
|
for (adapterIndex = 0; ; adapterIndex++)
|
||||||
{
|
{
|
||||||
DISPLAY_DEVICEW adapter;
|
DISPLAY_DEVICEW adapter;
|
||||||
|
int widthMM, heightMM;
|
||||||
|
HDC dc;
|
||||||
|
|
||||||
ZeroMemory(&adapter, sizeof(DISPLAY_DEVICEW));
|
ZeroMemory(&adapter, sizeof(DISPLAY_DEVICEW));
|
||||||
adapter.cb = sizeof(DISPLAY_DEVICEW);
|
adapter.cb = sizeof(DISPLAY_DEVICEW);
|
||||||
@ -122,12 +124,16 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
|||||||
if (!(adapter.StateFlags & DISPLAY_DEVICE_ACTIVE))
|
if (!(adapter.StateFlags & DISPLAY_DEVICE_ACTIVE))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
dc = CreateDCW(L"DISPLAY", adapter.DeviceName, NULL, NULL);
|
||||||
|
widthMM = GetDeviceCaps(dc, HORZSIZE);
|
||||||
|
heightMM = GetDeviceCaps(dc, VERTSIZE);
|
||||||
|
DeleteDC(dc);
|
||||||
|
|
||||||
for (displayIndex = 0; ; displayIndex++)
|
for (displayIndex = 0; ; displayIndex++)
|
||||||
{
|
{
|
||||||
DISPLAY_DEVICEW display;
|
DISPLAY_DEVICEW display;
|
||||||
_GLFWmonitor* monitor;
|
_GLFWmonitor* monitor;
|
||||||
char* name;
|
char* name;
|
||||||
HDC dc;
|
|
||||||
|
|
||||||
ZeroMemory(&display, sizeof(DISPLAY_DEVICEW));
|
ZeroMemory(&display, sizeof(DISPLAY_DEVICEW));
|
||||||
display.cb = sizeof(DISPLAY_DEVICEW);
|
display.cb = sizeof(DISPLAY_DEVICEW);
|
||||||
@ -143,13 +149,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
dc = CreateDCW(L"DISPLAY", adapter.DeviceName, NULL, NULL);
|
monitor = _glfwAllocMonitor(name, widthMM, heightMM);
|
||||||
|
|
||||||
monitor = _glfwAllocMonitor(name,
|
|
||||||
GetDeviceCaps(dc, HORZSIZE),
|
|
||||||
GetDeviceCaps(dc, VERTSIZE));
|
|
||||||
|
|
||||||
DeleteDC(dc);
|
|
||||||
free(name);
|
free(name);
|
||||||
|
|
||||||
if (adapter.StateFlags & DISPLAY_DEVICE_MODESPRUNED)
|
if (adapter.StateFlags & DISPLAY_DEVICE_MODESPRUNED)
|
||||||
|
Loading…
Reference in New Issue
Block a user