mirror of
https://github.com/glfw/glfw.git
synced 2024-11-14 06:23:50 +00:00
Added fallback for X11 monitor size.
This commit is contained in:
parent
20a49a7eee
commit
a2dab25b06
@ -454,6 +454,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
|||||||
{
|
{
|
||||||
XRROutputInfo* oi;
|
XRROutputInfo* oi;
|
||||||
XRRCrtcInfo* ci;
|
XRRCrtcInfo* ci;
|
||||||
|
int physicalWidth, physicalHeight;
|
||||||
|
|
||||||
oi = XRRGetOutputInfo(_glfwLibrary.X11.display, sr, sr->outputs[i]);
|
oi = XRRGetOutputInfo(_glfwLibrary.X11.display, sr, sr->outputs[i]);
|
||||||
if (oi->connection != RR_Connected)
|
if (oi->connection != RR_Connected)
|
||||||
@ -462,11 +463,24 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (oi->mm_width && oi->mm_height)
|
||||||
|
{
|
||||||
|
physicalWidth = oi->mm_width;
|
||||||
|
physicalHeight = oi->mm_height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
physicalWidth = DisplayWidthMM(_glfwLibrary.X11.display,
|
||||||
|
_glfwLibrary.X11.screen);
|
||||||
|
physicalHeight = DisplayHeightMM(_glfwLibrary.X11.display,
|
||||||
|
_glfwLibrary.X11.screen);
|
||||||
|
}
|
||||||
|
|
||||||
ci = XRRGetCrtcInfo(_glfwLibrary.X11.display, sr, oi->crtc);
|
ci = XRRGetCrtcInfo(_glfwLibrary.X11.display, sr, oi->crtc);
|
||||||
|
|
||||||
monitors[found] = _glfwCreateMonitor(oi->name,
|
monitors[found] = _glfwCreateMonitor(oi->name,
|
||||||
i == 0,
|
i == 0,
|
||||||
oi->mm_width, oi->mm_height,
|
physicalWidth, physicalHeight,
|
||||||
ci->x, ci->y);
|
ci->x, ci->y);
|
||||||
|
|
||||||
XRRFreeCrtcInfo(ci);
|
XRRFreeCrtcInfo(ci);
|
||||||
|
Loading…
Reference in New Issue
Block a user