From a0710d941f653944ac04aeefa4b56160a8f29969 Mon Sep 17 00:00:00 2001 From: Alastair Hughes Date: Sat, 23 Apr 2016 07:54:05 +1200 Subject: [PATCH] Added an error message if the display can't be opened --- demo/x11/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/demo/x11/main.c b/demo/x11/main.c index f58bb2e..46426ed 100644 --- a/demo/x11/main.c +++ b/demo/x11/main.c @@ -87,6 +87,8 @@ main(void) /* X11 */ memset(&xw, 0, sizeof xw); xw.dpy = XOpenDisplay(NULL); + if (!xw.dpy) die("Could not open a display; perhaps $DISPLAY is not set?"); + xw.root = DefaultRootWindow(xw.dpy); xw.screen = XDefaultScreen(xw.dpy); xw.vis = XDefaultVisual(xw.dpy, xw.screen);