Browse Source

Added an error message if the display can't be opened

Alastair Hughes 9 years ago
parent
commit
a0710d941f
1 changed files with 2 additions and 0 deletions
  1. 2 0
      demo/x11/main.c

+ 2 - 0
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);