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 [...].
This commit is contained in:
Benedikt Heine 2019-02-25 13:52:10 +01:00 committed by Nikos Tsipinakis
parent 59a87e4e99
commit 9bcb27f2e8

View File

@ -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();