From 2205bdd469fd9616916b7a56fb05517374b8a70e Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Mon, 6 Jul 2015 14:38:00 +0200 Subject: [PATCH] Improved X11 display opening failure. --- src/x11_init.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/x11_init.c b/src/x11_init.c index 0bd38485..8b7c7204 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -719,7 +719,18 @@ int _glfwPlatformInit(void) _glfw.x11.display = XOpenDisplay(NULL); 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; }