I was also looking for an answer. I do not know if you succeeded or not, but since you did not answer this question, I think you did not.
, , , , XCB. RandR XCB. , , , X-, . XCB cookie, ID . ? - X, ( , ).
, - , :
client : "I'd like to order a beer."
bartender: "OK, I'll get you a beer."
*bartender handles a ticket with an ID of the beer order to the client*
*client waits and waits and then he approaches bartender*
client : "Dude, give me my beer finally, here your damn ticket"
*client handles the ticket to bartender, who looks for the order from the
ticket in his order book and when he finds it he replies*
bartender: "Here your beer, enjoy."
, XCB ? , Xlib, , XCB 117 . , XCB XCB, .
- (, , CRTC)? , :
#include <cstdio>
#include <xcb/xcb.h>
#include <xcb/randr.h>
int main()
{
xcb_connection_t* XConnection = xcb_connect(0, 0);
xcb_screen_t* XFirstScreen = xcb_setup_roots_iterator(
xcb_get_setup(XConnection)).data;
xcb_window_t XWindowDummy = xcb_generate_id(XConnection);
xcb_create_window(XConnection, 0, XWindowDummy, XFirstScreen->root,
0, 0, 1, 1, 0, 0, 0, 0, 0);
xcb_flush(XConnection);
xcb_randr_get_screen_resources_cookie_t screenResCookie = {};
screenResCookie = xcb_randr_get_screen_resources(XConnection,
XWindowDummy);
xcb_randr_get_screen_resources_reply_t* screenResReply = {};
screenResReply = xcb_randr_get_screen_resources_reply(XConnection,
screenResCookie, 0);
int crtcs_num = 0;
xcb_randr_crtc_t* firstCRTC;
if(screenResReply)
{
crtcs_num = xcb_randr_get_screen_resources_crtcs_length(screenResReply);
firstCRTC = xcb_randr_get_screen_resources_crtcs(screenResReply);
}
else
return -1;
xcb_randr_get_crtc_info_cookie_t* crtcResCookie = new
xcb_randr_get_crtc_info_cookie_t[crtcs_num];
for(int i = 0; i < crtcs_num; i++)
crtcResCookie[i] = xcb_randr_get_crtc_info(XConnection,
*(firstCRTC+i), 0);
xcb_randr_get_crtc_info_reply_t** crtcResReply = new
xcb_randr_get_crtc_info_reply_t*[crtcs_num];
for(int i = 0; i < crtcs_num; i++)
crtcResReply[i] = xcb_randr_get_crtc_info_reply(XConnection,
crtcResCookie[i], 0);
for(int i = 0; i < crtcs_num; i++)
{
if(crtcResReply[i])
{
printf("CRTC[%i] INFO:\n", i);
printf("x-off\t: %i\n", crtcResReply[i]->x);
printf("y-off\t: %i\n", crtcResReply[i]->y);
printf("width\t: %i\n", crtcResReply[i]->width);
printf("height\t: %i\n\n", crtcResReply[i]->height);
}
}
xcb_disconnect(XConnection);
return 0;
}
:
CRTC[0] INFO:
x-off : 1920
y-off : 0
width : 1920
height : 1200
CRTC[1] INFO:
x-off : 0
y-off : 0
width : 1920
height : 1200
CRTC[2] INFO:
x-off : 0
y-off : 0
width : 0
height : 0
CRTC[3] INFO:
x-off : 0
y-off : 0
width : 0
height : 0
, vector whatnot , , .
XCB, PROBABLY - , . , , , -.
: