summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2012-07-08 02:10:53 +0200
committerAlexander Sulfrian <alexander@sulfrian.net>2012-07-08 02:15:04 +0200
commitbcf4e71312a2e5693aee2613f187a43f87c38a09 (patch)
treee026d50c92ec51462b5a9b0c88419bd8f27160ec
parentfbd6f18c2d703857d372fa2b23478775f0cf1efa (diff)
downloadxrandr-notify-bcf4e71312a2e5693aee2613f187a43f87c38a09.tar.gz
xrandr-notify-bcf4e71312a2e5693aee2613f187a43f87c38a09.tar.xz
xrandr-notify-bcf4e71312a2e5693aee2613f187a43f87c38a09.zip
exit with error if RandR is unavailable
Diffstat (limited to '')
-rw-r--r--xrandr-notify.c17
1 files 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);