Improved X11 display opening failure.

This commit is contained in:
Camilla Berglund 2015-07-06 14:38:00 +02:00
parent 0f3b69c79d
commit 2205bdd469

View File

@ -719,7 +719,18 @@ int _glfwPlatformInit(void)
_glfw.x11.display = XOpenDisplay(NULL); _glfw.x11.display = XOpenDisplay(NULL);
if (!_glfw.x11.display) if (!_glfw.x11.display)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to open X display"); const char* display = getenv("DISPLAY");
if (display)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"X11: Failed to open display %s", display);
}
else
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"X11: The DISPLAY environment variable is missing");
}
return GL_FALSE; return GL_FALSE;
} }