From 08005d711a6ff78d44667048a9239c808549c97e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Wed, 20 Apr 2011 21:05:16 +0100 Subject: [PATCH] Print an error message when not able to open X display. --- glws_glx.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/glws_glx.cpp b/glws_glx.cpp index 661e77d..64f8ce1 100644 --- a/glws_glx.cpp +++ b/glws_glx.cpp @@ -23,6 +23,9 @@ * **************************************************************************/ +#include +#include + #include "glimports.hpp" #include "glws.hpp" @@ -102,6 +105,10 @@ private: public: GlxWindowSystem() { display = XOpenDisplay(NULL); + if (!display) { + std::cerr << "error: unable to open display " << XDisplayName(NULL) << "\n"; + exit(1); + } screen = DefaultScreen(display); } -- 2.7.4