1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-22 10:18:51 -05:00

X11: Assume 96 DPI if RandR monitor size is zero

This falls back to calculating the monitor physical size from the
current resolution and the default X11 DPI when the physical size
returned by RandR is zero.
This commit is contained in:
Camilla Löwy 2019-11-05 13:09:01 +01:00
parent 2c519709be
commit e96dc5d219

View File

@ -161,6 +161,16 @@ void _glfwPollMonitorsX11(void)
heightMM = oi->mm_height;
}
if (widthMM <= 0 || heightMM <= 0)
{
// HACK: If RandR does not provide a physical size, assume the
// X11 default 96 DPI and calcuate from the CRTC viewport
// NOTE: These members are affected by rotation, unlike the mode
// info and output info members
widthMM = (int) (ci->width * 25.4f / 96.f);
heightMM = (int) (ci->height * 25.4f / 96.f);
}
_GLFWmonitor* monitor = _glfwAllocMonitor(oi->name, widthMM, heightMM);
monitor->x11.output = sr->outputs[i];
monitor->x11.crtc = oi->crtc;