quick question. Am I reading this right?

H

halfmaddad

Hi Everyone

I have encountered this snippet of code:
screen = xcb_setup_roots_iterator (xcb_get_setup (c)).data;

Is this correct, the results from xcb_get_setup are fed to xcb_setup_roots_iterator and the result from this is a struct. And this struct's "data" member is then assigned to screen ?

Thanks for reading-Patrick
 
A

Alain Ketterlin

I have encountered this snippet of code:
screen = xcb_setup_roots_iterator (xcb_get_setup (c)).data;

Is this correct, the results from xcb_get_setup are fed to
xcb_setup_roots_iterator and the result from this is a struct. And
this struct's "data" member is then assigned to screen ?

Exactly. More precisely: the result from xcb_get_setup [of type
"const xcb_setup_t *"] are fed to xcb_setup_roots_iterator and the
result from this is a struct [of type "xcb_screen_iterator_t"]. And this
struct's "data" member [of type "xcb_screen_t *"] is then assigned to
screen ?

Here are the relevant declarations from xcb.h and xproto.h
(in /usr/include/xcb on my box), both being fairly well documented:

const xcb_setup_t *xcb_get_setup(xcb_connection_t *c);

xcb_screen_iterator_t xcb_setup_roots_iterator (const xcb_setup_t *R);

typedef struct xcb_screen_iterator_t {
xcb_screen_t *data;
int rem;
int index;
} xcb_screen_iterator_t;

-- Alain.
 
J

James Kuyper

Hi Everyone

I have encountered this snippet of code:
screen = xcb_setup_roots_iterator (xcb_get_setup (c)).data;

Is this correct, the results from xcb_get_setup are fed to xcb_setup_roots_iterator and the result from this is a struct. And this struct's "data" member is then assigned to screen ?

Yes.
 
K

Keith Thompson

I have encountered this snippet of code:
screen = xcb_setup_roots_iterator (xcb_get_setup (c)).data;

Is this correct, the results from xcb_get_setup are fed to
xcb_setup_roots_iterator and the result from this is a struct. And
this struct's "data" member is then assigned to screen ?

Yes. (It's conceivable, but unlikely, that xcb_setup_roots_iterator()
returns a union rather than a struct.)

My only quibble is that I'd say "result" rather than "results".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top