X11: Assume 96 DPI if RandR monitor size is zero

From upstream: e96dc5d219.
This commit is contained in:
Luflosi 2019-11-21 18:37:08 +01:00
parent 4ea72a2892
commit d6072f6218
No known key found for this signature in database
GPG Key ID: 4E41E29EDCC345D0

10
glfw/x11_monitor.c vendored
View File

@ -166,6 +166,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;