From bcf4e71312a2e5693aee2613f187a43f87c38a09 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Sun, 8 Jul 2012 02:10:53 +0200 Subject: exit with error if RandR is unavailable --- xrandr-notify.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/xrandr-notify.c b/xrandr-notify.c index 3c1ad52..fc8e60d 100644 --- a/xrandr-notify.c +++ b/xrandr-notify.c @@ -23,15 +23,18 @@ int main(int argc, char **argv) has_randr = false; has_randr = XRRQueryExtension(dpy, &randr_event_base, &dummy); - if (has_randr) { - /* Get root window */ - screen = DefaultScreen(dpy) ; - root = RootWindow(dpy, screen) ; - - /* Notify on configuration change */ - XRRSelectInput(dpy, root, RRScreenChangeNotifyMask); + if (!has_randr) { + fputs("ERROR: RandR extension unavailable on current screen!\n", stderr); + return EXIT_FAILURE; } + /* Get root window */ + screen = DefaultScreen(dpy) ; + root = RootWindow(dpy, screen) ; + + /* Notify on configuration change */ + XRRSelectInput(dpy, root, RRScreenChangeNotifyMask); + while (true) { XNextEvent(dpy, &event); -- cgit v1.2.3