summaryrefslogtreecommitdiff
path: root/demo.c
diff options
context:
space:
mode:
Diffstat (limited to 'demo.c')
-rw-r--r--demo.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/demo.c b/demo.c
index 60eb318..e2b7c42 100644
--- a/demo.c
+++ b/demo.c
@@ -662,8 +662,14 @@ int main(int argc, char *const argv[])
}
/* Open the default X display and window, then obtain the RandR screen
- * resource. */
+ * resource. Note that the DISPLAY environment variable must exist. */
dpy = XOpenDisplay(NULL);
+ if (!dpy) {
+ printf("No display specified, check the DISPLAY environment "
+ "variable.\n");
+ return 1;
+ }
+
root = DefaultRootWindow(dpy);
res = XRRGetScreenResourcesCurrent(dpy, root);