1

I wrote an application using C++/Qt and libxrandr library to change the resolution and orientation of monitor. But I must extend the functionality. Help me please understand how to do the following:

  1. get a list of connected monitors
  2. change the resolution and orientation of each of them
  3. place them against each other (for example, the first monitor on the left, second from right)

1 Answer 1

2

problem solved

XRROutputInfo *output_first_info = XRRGetOutputInfo(dpy, sr, sr->outputs[X]); XRRSetCrtcConfig(dpy, sr, output_first_info->crtc, CurrentTime, XM, YM, sr->modes[M].id, R, &sr->outputs[X], 1); 

where X - number of monitor to configure XM, YM - coordinates in virtual screen M - number of mode

get list of modes for connected monitors:

     

 

int jj = 0;        for (int i = 0; i < sr->noutput; i++)        {            XRROutputInfo *output_info = XRRGetOutputInfo (dpy, sr, sr->outputs[i]);            XRRCrtcInfo *crtc_info = XRRGetCrtcInfo(dpy, sr, output_info->crtc);            for (int j = jj; j < output_info->nmode; j++)            {                qDebug() << output_info->name << sr->modes[j].name << j;                jj++;            }        } 
Sign up to request clarification or add additional context in comments.

1 Comment

Nice but what is R? Edit: It is a macro defining the rotation, e.g. RR_Rotate_0.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.