Create default monitor if Xrandr lookup fails

Allows glfwInit to succeed on headless systems
This commit is contained in:
Antti Tuppurainen 2014-01-02 15:13:25 +02:00
parent 7e806a8567
commit 699c899a49
2 changed files with 7 additions and 2 deletions

View File

@ -51,7 +51,11 @@ void _glfwInitGammaRamp(void)
XRRScreenResources* rr = XRRGetScreenResources(_glfw.x11.display, XRRScreenResources* rr = XRRGetScreenResources(_glfw.x11.display,
_glfw.x11.root); _glfw.x11.root);
if (XRRGetCrtcGammaSize(_glfw.x11.display, rr->crtcs[0]) == 0) if (rr->ncrtc == 0)
{
_glfw.x11.randr.gammaBroken = GL_TRUE;
}
else if (XRRGetCrtcGammaSize(_glfw.x11.display, rr->crtcs[0]) == 0)
{ {
// This is probably older Nvidia RandR with broken gamma support // This is probably older Nvidia RandR with broken gamma support
// Flag it as useless and try Xf86VidMode below, if available // Flag it as useless and try Xf86VidMode below, if available

View File

@ -251,7 +251,8 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
*count = found; *count = found;
} }
else
if (monitors == NULL)
{ {
monitors = calloc(1, sizeof(_GLFWmonitor*)); monitors = calloc(1, sizeof(_GLFWmonitor*));
monitors[0] = _glfwCreateMonitor("Display", monitors[0] = _glfwCreateMonitor("Display",