How to get each monitor's geometry with xlib when there is more than one screen ?

Thomas L├╝bking thomas.luebking at gmail.com
Tue Sep 29 04:08:15 PDT 2015


On Dienstag, 29. September 2015 10:56:33 CEST, Hacksign wrote:
> My monitor configuration is listed at the end of this email post.
> My problem:
>      can not get each monitor's width & height widh xlib.
> here is my code:


"monitor" = "output" != "screen" in X11 - nevertheless you're looking for
XRRScreenSize *XRRSizes(Display *dpy,
    int screen, int *nsizes);

Pass it the values you have and a reference to "int nsizes" and get back a list of
typedef struct {
    int    width, height;
    int    mwidth, mheight;
} XRRScreenSize;

don't forget to free that.

See http://linux.die.net/man/3/xrrscreenconfig

Notice that this only works as expected w/ the xrandr extension available. Otherwise you'll (afair) always have one screen with the combined size of the root window.

Cheers,
Thomas


More information about the xorg mailing list