mirror of
https://github.com/glfw/glfw.git
synced 2025-10-02 21:00:57 +00:00
Create default monitor if Xrandr lookup fails
Allows glfwInit to succeed on headless systems
This commit is contained in:
parent
7e806a8567
commit
699c899a49
@ -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
|
||||||
|
@ -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",
|
||||||
|
Loading…
Reference in New Issue
Block a user