wmaker: improve support for RandR

This patch is improving the support for RandR.
It uses version 1.3 released in March 2009.
Most of the support is done in randr.c/randr.h
It is built on top of the mature Xinerama structure
but Xinerama lib is not required.
Like for Xinerama, RandR is now auto enabled if the
library is found at compiled time.

RandR support can be used in 2 modes:
A static mode (which is the default) is to define manually
your setup with external tools like xrandr or arandr,
like for example what Openbox is doing.

A dynamic mode, which is triggered on hotplug events,
like for example what GNOME is doing.
If a new monitor is detected, it will select the best mode
available and add it to the right on the existing monitors.

The mode can be switched with a new option available in WindowMaker
conf file (or via WPrefs expert panel):

HotplugMonitor = NO;
This commit is contained in:
David Maciejak
2026-03-28 10:50:23 +00:00
committed by Carlos R. Mafra
parent 8e84264036
commit 1f03c13f4d
15 changed files with 792 additions and 21 deletions
+10 -14
View File
@@ -3,7 +3,7 @@
* Window Maker window manager
*
* Copyright (c) 1997-2003 Alfredo K. Kojima
* Copyright (c) 2014-2023 Window Maker Team
* Copyright (c) 2014-2026 Window Maker Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -46,7 +46,7 @@
#endif
#ifdef USE_RANDR
#include <X11/extensions/Xrandr.h>
#include "randr.h"
#endif
#include <X11/XKBlib.h>
@@ -271,10 +271,6 @@ void DispatchEvent(XEvent * event)
break;
case ConfigureNotify:
#ifdef USE_RANDR
if (event->xconfigure.window == DefaultRootWindow(dpy))
XRRUpdateConfiguration(event);
#endif
break;
case SelectionRequest:
@@ -618,14 +614,14 @@ static void handleExtensions(XEvent * event)
#endif /*KEEP_XKB_LOCK_STATUS */
}
#ifdef USE_RANDR
if (w_global.xext.randr.supported && event->type == (w_global.xext.randr.event_base + RRScreenChangeNotify)) {
/* From xrandr man page: "Clients must call back into Xlib using
* XRRUpdateConfiguration when screen configuration change notify
* events are generated */
XRRUpdateConfiguration(event);
WCHANGE_STATE(WSTATE_RESTARTING);
Shutdown(WSRestartPreparationMode);
Restart(NULL,True);
if (w_global.xext.randr.supported &&
(event->type == (w_global.xext.randr.event_base + RRScreenChangeNotify) ||
event->type == (w_global.xext.randr.event_base + RRNotify))) {
WScreen *randr_scr;
randr_scr = wScreenForRootWindow(event->xany.window);
if (randr_scr)
wRandRHandleNotify(randr_scr, event);
}
#endif
}