[Xcb] xcb_setup_roots_iterator

Ben Hildred 42656e at gmail.com
Fri Jul 17 17:45:08 PDT 2015

So I wanted to really understand how the xcb layer works, so I thought I
would port a couple c language XCB examples to perl. I assure you this is a
great way to learn especially as X11::XCB is a work in progress. Anyway I
hit a line that I really don't understand, that I was hoping that someone
could explain to me, or point me to the relevant doc.

xcb_connection_t    *c;
xcb_screen_t        *screen;
c = xcb_connect (NULL, NULL);
screen = xcb_setup_roots_iterator (xcb_get_setup (c)).data;

so we declare some variables, and connect. ok all good so far, and screen
is a pointer to a useful struct that contains a lot of useful information,
that I'm learning to use, but why are we doing a double function call? this
does seem to be a common idiom as I have seen it from at least three
different programmers. What are these two functions documented and why does
noone keep the results from xcb_get_setup around so that you don't have to
keep calling it especially when calling xcb_setup_toots_iterator which
always seems to also call xcb_get_setup? At the moment this is not a
critical problem as I am writing code that works, I just don't understand
what is going on with that line.
Ben Hildred
Automation Support Services
303 815 6721
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/xcb/attachments/20150717/41ac7178/attachment.html>

More information about the Xcb mailing list