From 9bcb27f2e8f6f4a42b2c78344a9061f933ff5d8f Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Mon, 25 Feb 2019 13:52:10 +0100 Subject: [PATCH] Pass the RRScreenChangeNotify event to libxrandr From Xrandr(3): > Clients must call back into Xlib using XRRUpdateConfiguration when > screen configuration change notify events are generated [...]. --- src/x11/screen.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/x11/screen.c b/src/x11/screen.c index a9ac74a..357b9c5 100644 --- a/src/x11/screen.c +++ b/src/x11/screen.c @@ -25,8 +25,6 @@ int screens_len; bool dunst_follow_errored = false; -int randr_event_base = 0; - static int randr_major_version = 0; static int randr_minor_version = 0; @@ -90,8 +88,8 @@ void alloc_screen_ar(int n) void randr_init(void) { - int randr_error_base = 0; - if (!XRRQueryExtension(xctx.dpy, &randr_event_base, &randr_error_base)) { + int ignored; + if (!XRRQueryExtension(xctx.dpy, &ignored, &ignored)) { LOG_W("Could not initialize the RandR extension. " "Falling back to single monitor mode."); return; @@ -145,7 +143,7 @@ static int autodetect_dpi(struct screen_info *scr) void screen_check_event(XEvent event) { - if (event.type == randr_event_base + RRScreenChangeNotify) { + if (XRRUpdateConfiguration(&event)) { LOG_D("XEvent: processing 'RRScreenChangeNotify'"); randr_update();