mirror of
https://github.com/glfw/glfw.git
synced 2024-12-02 00:54:36 +00:00
Implemented RandR monitor mode retrieval.
This commit is contained in:
parent
d75c06a994
commit
6fc6c93223
@ -612,13 +612,49 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
|
|||||||
|
|
||||||
void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
|
void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
|
||||||
{
|
{
|
||||||
_glfwSplitBPP(DefaultDepth(_glfwLibrary.X11.display,
|
if (_glfwLibrary.X11.RandR.available)
|
||||||
_glfwLibrary.X11.screen),
|
{
|
||||||
&mode->redBits, &mode->greenBits, &mode->blueBits);
|
#if defined (_GLFW_HAS_XRANDR)
|
||||||
|
XRRScreenResources* sr;
|
||||||
|
XRRCrtcInfo* ci;
|
||||||
|
|
||||||
|
sr = XRRGetScreenResources(_glfwLibrary.X11.display,
|
||||||
|
_glfwLibrary.X11.root);
|
||||||
|
if (!sr)
|
||||||
|
{
|
||||||
|
_glfwSetError(GLFW_PLATFORM_ERROR,
|
||||||
|
"X11: Failed to retrieve RandR screen resources");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ci = XRRGetCrtcInfo(_glfwLibrary.X11.display,
|
||||||
|
sr, monitor->X11.output->crtc);
|
||||||
|
if (!ci)
|
||||||
|
{
|
||||||
|
XRRFreeScreenResources(sr);
|
||||||
|
|
||||||
|
_glfwSetError(GLFW_PLATFORM_ERROR,
|
||||||
|
"X11: Failed to retrieve RandR crtc info");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mode->width = ci->width;
|
||||||
|
mode->height = ci->height;
|
||||||
|
|
||||||
|
XRRFreeCrtcInfo(ci);
|
||||||
|
XRRFreeScreenResources(sr);
|
||||||
|
#endif /*_GLFW_HAS_XRANDR*/
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
mode->width = DisplayWidth(_glfwLibrary.X11.display,
|
mode->width = DisplayWidth(_glfwLibrary.X11.display,
|
||||||
_glfwLibrary.X11.screen);
|
_glfwLibrary.X11.screen);
|
||||||
mode->height = DisplayHeight(_glfwLibrary.X11.display,
|
mode->height = DisplayHeight(_glfwLibrary.X11.display,
|
||||||
_glfwLibrary.X11.screen);
|
_glfwLibrary.X11.screen);
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfwSplitBPP(DefaultDepth(_glfwLibrary.X11.display,
|
||||||
|
_glfwLibrary.X11.screen),
|
||||||
|
&mode->redBits, &mode->greenBits, &mode->blueBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user