I've been working on a window manager and I've just started thinking about how to handle multiple monitor setups. I did some research on whether to use Xinerama or XRandr, and eventually decided on using XRandr, however I can not find any documentation whatsoever on how to use the XRandr header file, besides the header file on my computer (<X11/extensions/Xrandr.h>) and this StackOverflow question.
I've tried googling some of the function's names and simple terms like "XRandr documentation" but all I find is man pages for the command line tool, more header files, or this doc which doesn't explain how to use it.
Could anybody find me a relevant doc page for this header? Thanks in advance.
There’s a man 3 Xrandr
.
Quick redundant excerpt:
Functions
There are two classes of interfaces: those which can be safely called even if RandR is not implemented on a screen (to make common idioms not dependent on the server having support), and those which will return errors if the extension is not present.
XRRRotations returns both the possible set of rotations/reflections supported (as a bitmask) as the value of the function, along with the current rotation/reflection of the screen.
XRRSizes returns the size and a pointer to the current sizes supported by the specified screen. The first size specified is the default size of the server. If RandR is not supported, it returns 0 for the number of sizes.
XRRRates returns a pointer to the rates supported by the specified size. If RandR is not supported, it returns 0 for the number of rates.
XRRTimes returns the time last reported by the server along with the timestamp the last configuration changed. If the configuration has changed since the client last updated its view of the server time, requests to change the configuration will fail until the client has an up to date timestamp.
XRRRootToScreen returns the screen number given a root window (for example, from an XRRScreenChangeNotifyEvent).
The rest of the functions will fail if applied to screens not implementing the RandR extension. XRRSetScreenConfig sets the screen size and rotation and reflection to the desired values on the screen specified by draw, or returns a BadValue error. size_index specifies which size configuration is to be used, rotation specifies which rotation or reflection is to be used (or a BadValue error is returned). The timestamp is used by the server to make sure the client has up to date configuration information. Status is returned to indicate success or failure; a client must refresh its configuration information if it fails and try the call again (by calling XRRGetScreenInfo).
XRRSetScreenConfigAndRate is like XRRSetScreenConfig but also sets the refresh rate. If specified rate is not supported a BadValue error is returned.
XRRConfigRotations, XRRConfigSizes, XRRConfigCurrentConfiguration, XRRConfigTimes, XRRConfigRates, and XRRConfigCurrentRate are used to get specific configuration information out of a screen configuration.
XRRGetScreenInfo returns a screen configuration for later use; the information is private to the library. Call XRRFreeScreenConfigInfo to free this information when you are finished with it. It forces a round trip to the server.
Other functions include: XRRQueryExtension which returns the event and error base codes, XRRQueryVersion , which returns the current version of the extension (this information is cached by the library).