From 56dfc25baf27372070ceb36ca6f3496ef0ab3ea1 Mon Sep 17 00:00:00 2001 From: Nikos Tsipinakis Date: Wed, 19 Apr 2017 08:18:44 +0300 Subject: [PATCH] Add warning if RandR initialization fails Since currently the multimonitor extension support is a compile-time argument, there is not much we can do to recover from not being able to initialize RandR other than print an error and exit. --- src/x11/screen.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/x11/screen.c b/src/x11/screen.c index 3b197a8..efad643 100644 --- a/src/x11/screen.c +++ b/src/x11/screen.c @@ -77,7 +77,10 @@ int randr_event_base = 0; void init_screens() { int randr_error_base = 0; - XRRQueryExtension(xctx.dpy, &randr_event_base, &randr_error_base); + if (!XRRQueryExtension(xctx.dpy, &randr_event_base, &randr_error_base)) { + fprintf(stderr, "Dunst was compiled with RandR but RandR extension is missing."); + exit(1); + } XRRSelectInput(xctx.dpy, RootWindow(xctx.dpy, DefaultScreen(xctx.dpy)), RRScreenChangeNotifyMask); x_update_screens(); }